The view at '~/Areas/SomeArea/Views/List/Index.cshtml' must derive from ViewPage, ViewPage, ViewUserControl, or ViewUserControl.
The project structure is pretty much default. There is one area called SomeArea. It has a single controller called List. It does nothing except:
public ActionResult Index()
{
return View("~/Areas/SomeArea/...
Hi, I want to specify (in one place) a default layout page in Razor, so that I can delete this:
@{ LayoutPage = "~/Views/Shared/_Layout.cshtml"; }
from every .cshtml file I have. But I don't know how... Any ideas? I'm using Razor engine from ASP.NET MVC 3 Preview 1.
...
In my understanding, the ViewModel pattern was designed to pass all the relevant data to View because 1) the view shouldn't perform any data retrieval or application logic and 2) it enables type-safety, compile-time checking, and editor intellisense within view templates.
Since dynamic expressions are defined at runtime, does this mean ...
Razor looks like a winner for developers...close to the metal, yet quick and efficient.
As a developer who is not good with a designer's stylus pen, at some point I want to pass my ham-handed design to a professional designer. What will be the design surface that such a designer will use? Will Expression Web be enabled with a knowled...
I'm trying to use the new JSON ModelBinders in MVC 3 which Scott Guthrie talks about in his blog.
My example is very similar to the one he is using. I have a model with 3 values which I am trying to POST to the server.
The model looks like this:
public class CommentViewModel
{
public string Product { get; set; }
public string...
I have created a sample project using ASP.NET MVC 3 Web Application (Razor) template. When I run my application I get this error
'SampleApp.MvcApplication' is not allowed here because it does not extend class 'Microsoft.WebPages.WebPageHttpApplication'
Where should i look for the problem?
...
A simple question though. I am creating a sample AP.NET MCV 3 site using Razor as view engine. The razor syntax starts with @ character e.g. @RenderBody(). If I write @test on my cshtml page it gives me parse error CS0103: The name 'test' does not exist in the current context. How do i escape '@' character?
...
I'm using the new Razor ViewEngine with ASP.NET 4/ASP.NET MVC 3.
In both Cassini on my local machine (Win7 x64/VS 2010), as well as IIS7 (Windows Web Server 2008), I'm randomly getting "Could not load file or assembly" errors.
With Cassini, rebuilding the solution generally fixes the problem.
In IIS7, recycling the application pool ge...
Hi geeks,
I am trying to create user by registration form which contains dropdown for profession in ASP.NET MVC
Eg. Individual, professional, manager etc.
some fields are common like name & Last Name...
some fields are unique by profession...
how do i program it with ajax.
Thanks
...
@ in asp.net mvc 3 preview 1 automaticly encodes html, is there an alternative way to let there be html?
think of this scenario:
@view.BestSitesEver.Replace("stackoverflow", "<h1>StackOverflow</h1>")
That would just print out: <h1>stackoverflow</h1>
...
Similar to using Shortcut = System.Whatever; in the cshtml I have so far been out of luck doing something similar in the webconfig
<pages>
<namespaces>
<add namespace="System.Web.Routing" as="Routing" />
</namespaces>
</pages>
Something like that...Is it possible at all?
...
In MVC 2 with the regular view engine i could return a ascx partial view as string through return Json()
But with the new Razor .cshtml views I can not figure out how to do this. I keep getting Type 'ASP.CustomerForm_cshtml' does not inherit from 'System.Web.UI.UserControl'.
The partial view inherits from System.Web.Mvc.WebViewPage<T> ...
I try to add client side validation using this line of code:
@Html.EnableClientValidation()
But I keep getting this error message:
Compiler Error Message: CS1502: The best overloaded method match for 'Microsoft.WebPages.WebPageUltimateBase.Write(Microsoft.WebPages.Helpers.HelperResult)' has some invalid arguments
Is this working for ...
I have a table with repeating customer rows, I would like to add the customer ID to the ID attribute of my table rows like this:
<tr id="row<customer id>"></tr>
I try adding this code:
@foreach(var c in Model) {
<tr id="[email protected]"></tr>
}
Which gives me the following output:
<tr id="[email protected]"></tr>
<tr id="[email protected]"></tr>
etc....
I've been searching around on the Goog, but because technology moves so quickly, all my results are seemingly obsolete (brushing the dust off).
I'm looking for the Razor Roadmap for MVC. I know it went preview, but I'm wondering about the full blown release. I really want to start using Razor, but I'm not sure what the implications wo...
With the asp.net mvc web form engine, you could define a content placeholder and specify the default content. How is this done with Razor engine?
This is the only way I found - but it seems like there would be a better way.
_Layout.cshtml:
@if (IsSectionDefined("Footer"))
{
@RenderSection("Footer")
}
else
{
<text>Default fo...
i am using asp.net MVC and have been using mvc for quite a while now but i have something along the lines of this:
@View.greeting | <a href="/Login/Logout">LOGOUT</a>
i have to but in the logout link as if i try to pass it over the @View will html encode
and show the html of the link, i would prefer to deliver a result of login or log...
so according to Gu IValidatableObject.Validate() should get called when a controller validates it's model (i.e. before ModelState.IsValid) however simply making the model implement IValidatableObject doesn't seem to work, because Validate(..) doesn't get called.
Anyone know if there is something else I have to wire up to get this to wor...
I'm working on my first ASP.NET MVC (beta for version 3) application (using EF4) and I'm struggling a bit with some of the conventions around saving a new record and updating an existing one. I am using the standard route mapping.
When the user goes to the page /session/Evaluate they can enter a new record and save it. I have an action ...
Caveat: This might be an inappropriate use of C#'s dynamic keyword and I probably should be using a strongly-typed view model, but...
I'm trying to avoid creating a strongly-typed view model by passing a C# 4 dynamic type to my view. I have this in my controller:
public ActionResult Index()
{
var query =
fro...