MVC :: Razor View Engine And Add Namespace In Web.Config

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


Similar Messages:

Is It Possible To Use Razor View Engine Outside

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

Does The Razor View Engine Work For Mono

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

MVC :: How To Integrate Razor View Engine Into Web Application

Dec 21, 2010

How to integrate Razor view engine into mvc 2 web application?

View 3 Replies

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

MVC :: Does The Razor View Engine Support Generic Methods

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

Razor View Engine Intellisense Not Working VS 2010?

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

Installing The Razor View Engine For Visual Studio?

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

MVC :: Changing View Engine In Existing Project To Razor?

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

MVC :: Razor View Engine - How To Register The Partial Views In 3 Beta

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

How To Import A Namespace In Razor View Page

Jul 13, 2010

How to import a namespace in Razor View Page?

View 3 Replies

How To Use Razor View Engine Auto-complete To Work In A Class Library

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

Adding A 3rd Party Test Framework For MVC3 And Razor View Engine?

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

MVC :: Razor View Engine With ". NET Empty Web Application"?

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

MVC :: How To Create Partial Views Using The Razor Engine

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

MVC :: Create User Control Using Razor Engine?

Mar 8, 2011

How to create user control using razor engine?

*.ascx ==> old way, using aspx engine

View 1 Replies

MVC :: Running A String Through The Razor Engine Instead Of A Cshtml File?

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

How To Hide Specific Elements On A Razor View Based On Security Without Logic In View

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

MVC 3 - Razor - Trying To Use A Partial View For A File Upload In A Create View?

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

C# - Referencing Namespace From Web.Config?

Jul 27, 2010

Can I declare namespaces in the web.config so that I don't have to write using statements for each namespace in each of my codebehind files?

View 3 Replies

Configuration :: Add Namespace In Child Web.config?

Mar 8, 2010

I have a really tricky problem that I just don't seem to find a fix to. I have looked "everywhere" and this is my last hope.
In the root I have a web.config with a few namespaces added in the <pages> tag.

Then, I will use one subfolder for every customer with a unique web.config for each customer. Thing is that the scripts on the sites depend on a specific class for each company, located in App_Code / CustomerSpecific / <customername> / CustomerConstants.vb

Every class is embedded in a namespace with the customers name. So, if we only had one customer then the web.config in the root could say:

add namespace="customer1"

But, my plan is that every web.config in each customerfolder shall state what company name to use.
Then I can read just this customer's settings in the vb from the right file depending on the namespace.

Here comes the problem, when I test this, the site in the customer folder only reads the namespaces in the root web.config (I have tested with appsettings though and they read perfectly even from the child web.config, so there's no problem in reading from it). So something seems to be the matter with adding namespaces in the root web.config and then adding others in the child web.config.

Before you answer; yes, I have tried with both <clear /> and <remove> specific namespaces and it doesn't work anyway. The namespaces in the root web.config seems to be overriding anyway.

View 3 Replies

WCF / ASMX :: How To Set WebService NameSpace In Web.config File

Aug 27, 2010

I am trying to put the namespace value as a key in web.config file, so that when I deploy this on production, I just have to change the namespace key in the config file only, not on all of my webservice cs files. But When I try to browse this webservice after changing this code I get compilation error.

web.config:

[Code]....

MyWebService.cs (this code works)

[Code]....

Compiler Error Message: CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

View 1 Replies

Can't Setup Mvc 2 RC And Spark View Engine

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

A XAML Based View Engine For MVC?

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

Built An MVC Application Using XSL As The View Engine? 

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







Copyrights 2005-15 www.BigResource.com, All rights reserved