MVC :: Razor View Engine - 'content' From DB Using VirtualPathProvider?
Dec 14, 2010
I'm working trying to realize a requirement where the pages should be 'configurable' at runtime (per client), stored in a database - a requirement that I have no say in Anyway, the current plan is to use the Razor view engine and 'load' the 'pages' dynamically. I have a basic sample working using a VirtualPathProvider and VirtualFile that serves up Raz'pages' on the fly.The question I have if there is a better approach when I have the Razor 'pages' stored in a dB (or any other repository)?
There seems to be some constraints and concerns when I check other postings. For example:'If a Web site is precompiled for deployment, content provided by a VirtualPathProvider instance is not compiled, and noVirtualPathProvider instances are used by the precompiled site.'
(from http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx )
View 1 Replies
Similar Messages:
Sep 2, 2010
If I look at the Razor View Engine, then I see a very nice and concise syntax that is not particularly tied to generating html. So I wonder, how easy would it be to use the engine outside asp.net in a "normal" .net environment for example to generate text, code,...
View 3 Replies
Nov 21, 2010
I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono?
View 3 Replies
Dec 21, 2010
How to integrate Razor view engine into mvc 2 web application?
View 3 Replies
Aug 22, 2010
I am working on a MVC project with Razor view engine and I have the following:
[Code]....
This only works if I have on the same view the following:
[Code]....
So if "SquishIt.Framework" namespace is added on Web.Config why do I need to have the @using on the view?
View 4 Replies
Sep 3, 2010
Trying out the Razor view engine and for some reason my generic helper methods are breaking. For example:
public static class UrlHelperExtensions
{
public static string NonGenericHelper(this UrlHelper helper, Type controller)
{
return controller.Name;
}
public static string GenericHelper<TController>(this UrlHelper helper)
{
return typeof(TController).Name;
}
}
Works as expected:@Url.NonGenericHelper(typeof(ProjectEuler.UI.Models.Home))Breaks with the following exception:
@Url.GenericHelper<ProjectEuler.UI.Models.Home>()
"CS1502: The best overloaded method match for 'Microsoft.WebPages.WebPageUltimateBase.Write(Microsoft.WebPages.Helpers.HelperResult)'
has some invalid arguments"
The only workaround I could find is treating it as a "multi-token
statement":
@(Url.GenericHelper<ProjectEuler.UI.Models.Home>())
Not sure if this is the intended behavior or just a bug but it would be nice to be able to call a generic method as you would a non generic one.
View 2 Replies
Feb 7, 2011
Inside VS 2010 I do not have any intellisense working. I have reinstalled everything and still nothing is coming up for intellisense?
View 2 Replies
Jul 14, 2010
I just downloaded and installed Web Matrix beta.
I am really liking the razor view engine.
Not so much the Web Matrix IDE.
Is there any way to install razor view engine for use in the Visual Studio without installing WebMatrix?
View 4 Replies
Nov 15, 2010
how do I change the view engine from aspx to razor in an existing project? If I just change the file extension to cshtml I always get "The controller for path '/path/About' was not found or does ..."
View 2 Replies
Oct 15, 2010
On my projects I am using Razor View engine and I need to define custom Partial folders:
[Code]....
I had this because there was a problem in MVC 3 Preview. Was it corrected?
How should I register the Partial Views in MVC 3 Beta?
View 1 Replies
Nov 11, 2010
We have a modular architecture where we have some views (cshtml) files in a separate project (class library). How can we get the syntax highlighting and autocomplete to work when the project isn't an MVC project?
note that the class library has controllers, views, models etc. It just doesn't have the web.config, global.asax, etc that a normal mvc project would have.
The intellisense works for everything but the so important model:
With MVC3 RTM, if you hover over the Model, you can now get a better error message:
[code]....
Then after adding the build provider, this error message appears:
[code]....
View 3 Replies
Feb 19, 2011
Would like to add a third party test framework (such as NUnit or MbUnit) to the drop-down list of test projects for the ASP.NET MVC3 type project in Visual Studio 2010.
This had worked before for ASP.NET MVC2 and prior, but the msdn instructions are not accurate and does not work. Creating the registry keys in the HKEY_CURRENT_USER seem to delete the keys every time the VS-2010 starts, the HKEY_LOCAL_MACHINE does not follow the same tree structure.
how to add a third party framework under ASP.NET MVC3?
View 3 Replies
Jan 18, 2011
point me in the direction of getting the Razor View Engine working correctly with an empty "non MVC" web application. I can correctly set it up with a MVC app or with a Web Site (Razor), but if I try and get it running with and empty app, I run into the following two problems:
1) I can't add new razor files to the application (*.cshtml files)
2) Once deployed to AppHarbor, the .cshtml files aren't found unless they have the extension specified (i.e. /Default won't work, but /Default.cshtml does)
View 3 Replies
Jan 20, 2011
Using the Razor engine how do I create Partial Views. Do I create a normal View and calling the PartialView() in the controller will only output the body content and when calling View() in the controller will output the full page with layout. If not, do I need to create specific Partial Views and then use RenderPartial in the View.
View 6 Replies
Mar 8, 2011
How to create user control using razor engine?
*.ascx ==> old way, using aspx engine
View 1 Replies
Mar 29, 2011
In my application users can write their own 'templates'. That are filled with data from other sources. I could use a simple token replacement, but I would like to be able to use the Razor syntax and engine for rendering the template. Here is an overly simplified example:
[Code]....
Before you point to the following sources I will clarify what I have learned from them:RazorEngine (http://razorengine.codeplex.com/). This code compiles the string into a class, then a dll, then finally reads from a dll - all this to bypass the MVC engine. I don't want to do that because I am in MVC and don't want the additional overhead.The following blog shows how to do this for one of the MVC 3 pre-releases:http://buildstarted.com/2010/09/28/mvc-3-razor-view-engine-without-a-controller/ I cannot get it to work with MVC 3 RTM. When I take the exact code (and replace the CshtmlView with a RazorView) I end up with the error: The method or operation is not implemented. It appears to have something to do with @Model.Name, and being unable to find "Name".A comment in the blog elludes to a statement from ScottGu that the RTM would allow this functionality from the get go. I cannot find this blog.
View 10 Replies
Apr 4, 2011
I have looked all over for elegant solutions to this not so age-old question. How can I lock down form elements within an ASP.Net MVC View, without adding if...then logic all over the place? Ideally the BaseController, either from OnAuthorization, or OnResultExecultion, would check the rendering form elements and hide/not render them based on role and scope. Another approach I have considered is writing some sort of custom attributes, so as to stay consistent with how how we lock down ActionResults with [Authorize]. Is this even possible without passing a list of hidden objects to the view and putting if's all over? Other background info: We will have a database that will tell us at execution time (based on user role/scope) what elements will be hidden. We are using MVC3 with Razor Viewengine. We're utilizing a BaseController where any of the Controller methods can be overridden.
View 1 Replies
Oct 19, 2010
I am trying to use a partial view for a file upload in a Create View.
Here is my partial view, I removed the submit button, as the view it is rendered in, should activat the form post:
@model dynamic
View 1 Replies
Aug 1, 2010
I would like to create personal web site including search engine in my site content. I don't know algorithem how to build it yet. how to build my own search engine?
View 1 Replies
Nov 5, 2010
I am using Razor and MVC 3 WebGrid in ASP.NET MVC 3 Beta.
I have the following:
[Code]....
I am not able to have two ActionLinks on the same column. In this case I get the following error:
The best overloaded method match for 'System.Web.Helpers.WebGrid.Column(string, string, System.Func<dynamic,object>, string, bool)' has some invalid arguments
This is usefull not just for this but to create columns that contains more information then just a field.
I also tried Razor's <text> but no luck ... Maybe I used it wrong.
View 5 Replies
Jan 26, 2010
how to fix "Method not found: 'Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary)'." exception. This solution doesn't work http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-preview-2.aspx.
View 3 Replies
Apr 17, 2010
As ASP.NET MVC has a pluggable view engine architecture, and XAML is an object descriptive mark-up that, given the right processor/ parser, can generate an appropriate UI...are there plans/ efforts to create a view engine that can turn XAML into HTML?
Personally, I think this would help to re-enforce the efforts the WPF/ Silverlight people have gone to in providing a means of seperating the view from the model/ business logic between designers and developers (via Visual Studio and Expression Blend)...
Seems like a logical step to me, but not knowing XAML as well as I should, I'm wondering if feasable, or even relevant.
View 3 Replies
Feb 11, 2011
if anyone has built an MVC application using XSL as the view engine? One of my aims is to allow the designer to create multiple skins using xsl files.
View 3 Replies
Mar 12, 2011
I have used the xslt code from Steven Sandersons book 'Pro ASP.NET MVC2 Framework' for the xslt view engine and that is working perfectly. However I am now looking at using a master page for the header, footer, and navigation sections and only need to use my other xslt files to populate the content part.
View 3 Replies
Jan 19, 2010
I have an asp:DataGrid with templated columns. Here's one of those columns:
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="btnDetails"
Runat="server"
CommandName="details"
Text="Details"
Font-Size="0.8em"
CommandArgument='a=<%# Eval("a")%>&b=<%# Eval("b")%>' />
<...>
When the command fires, the CommandArgument comes back unevaluated - it is the string a=<%# Eval("a")%>&b=<%# Eval("b")%>, not a=5&b=6 as I want. What's wrong with how I'm doing this?
View 2 Replies