In my ASP.net MVC app I have a view that looks like this:
...
<%=Html.TextBox(\"due\")%>
...
I am usi
In order to get strongly typed access to your model in the code behind of your view you can do this:
public partial class SomethingView : ViewPage
{
}
Where T is the ViewData type that you want to pass in from your Action.
Then in your controller you would have an action :
public ActionResult Something(){
T myObject = new T();
T.Property = DateTime.Today();
Return View("Something", myObject);
}
After that you have nice strongly typed model data in your view so you can do :
<%=Html.TextBox(ViewData.Model.Property.ToShortDateString())%>