Code generation for views broken when using custom MVC ViewData classes

Code generation for views broken when using custom MVC ViewData classes

I'm by no means lazy, but already 2 days overdue on our current sprint in my first ever MVC project, so I've been using the Add View Wizard to generate strongly typed views, but now that I have started using ViewData classes as view models, the wizard generates fields for ViewDataBase, and not my derived ViewData.

I think that the derived ViewData is built by a factory at runtime, and assume that is why the designer/wizard can only give me the base class properties, but is there anything I can do about this?

When is it ok to meddle in the page lifecycle an ASP.NET MVC page?


Significant advantages of ASP.NET MVC
ProfK,. ASP.NET MVC application fires Session_Start multiple times for a single session Here is what I tried (VS 2010, MVC2):. MVC Binding
public class ViewDataBase {     public int ID { receive ; set; }     public string Name { receive ; set; } }  public class CustomerViewData : ViewDataBase {     public string Address { receive ; set; } } 
Right clicked on my Action and created a strongly typed Details view using CustomerViewData. Deploy ASP.NET website alongside ASP.NET MVC websiteThe following receive s generated:. style problem with data returned from action method
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<MyApplication.Models.CustomerViewData>" %>      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">      <html xmlns="" >     <head runat="server">         <title>Index</title>     </head>     <body>         <fieldset>             <legend>Fields</legend>              <div class="display-label">Address</div>             <div class="display-field"><%: Model.Address %></div>              <div class="display-label">ID</div>             <div class="display-field"><%: Model.ID %></div>              <div class="display-label">Name</div>             <div class="display-field"><%: Model.Name %></div>          </fieldset>         <p>             <%: Html.ActionLink("Edit", "Edit", new { /* id=Model.PrimaryKey */ }) %> |             <%: Html.ActionLink("Back to List", "Index") %>         </p>      </body>     </html> 
Email errors in a mvc application

92 out of 100 based on 57 user ratings 452 reviews