I have an mvc aspx page with strongly typed model, it looked like this
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DeliveryService.ViewModels.DeliveryRequestViewModel>" %>
so when I call a create function, the page shows the initialized data from the view model
but when I submit the form (calling the postback create function)
I got a null exception error like on the line:
<%: Html.DropDownListFor(model => model.FromGroup, Model.LocationList) %>
the error pointed to Model.LocationList
I have another field in the aspx page, but it doesn't triggering null exception, the code looks like this
<%: Html.EditorFor(model => model.Address) %>
Please point my error, why is when I use the Model with capital at the first letter I get a null exception error. Thank you very much
I have an extra question:
<%: Html.EditorFor(model => model.DeliveryRequestNumber, new {@readonly = "readonly"}) %>
what is the correct syntax to create a readonly textbox using editorfor? tried this but, the rendered html code is
<input class="text-box single-line valid" id="DeliveryRequestNumber" name="DeliveryRequestNumber" type="text" value="somevaluegeneratedfrommodel">