Hello everyone,
I have bind list of model data. After I want pass to controller. But the controller model object showing null value. How can I solve this?
- @model IEnumerable<Reboxwebapp.Models.ViewModel.ProductItemsVM>
- @foreach (var item in Model)
- {
- if (item.AttributeControlType == "textbox")
- {
- <tr><td>@Html.TextBox("AttributeName", item.AttributeName ?? " ")</td><td>@Html.TextBox("txtValidValues", item.ValidValues ?? " ", new { maxlength = item.AttributeMaxLength ?? 0 })</td></tr>
- }
- else if (item.AttributeControlType == "DropDownList")
- {
- <tr><td>@Html.TextBox("AttributeName", item.AttributeName ?? " ")</td><td>@Html.DropDownList("ddlValidValues", new SelectList(item.ValidValues.Split(new char[] { ',' })), new { style = "height: 20px;", size = item.AttributeMaxLength ?? 0 })</td></tr>
- }
- else if (item.AttributeControlType == "checkbox")
- {
- <tr><td>@Html.TextBox("AttributeName", item.AttributeName ?? " ")</td><td><ul><li> <input type="checkbox" id="chkValidValue" checked /></li>@item.ValidValues<li></ul></td></tr>
- }
- }