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>
- }
- }


Saineshwar BageriRank #115 · 19.6K reputationPosted Jan 21, 2017, 7:29 PM EST
Bryian TanRank #396 · 6.3K reputationPosted Jan 21, 2017, 7:30 PM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Jan 21, 2017, 7:41 PM EST