TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhilash J A
533
2.4k
598.2k
How to pass model data from dynamic bind cshtml mvc4
Jan 21 2017 4:29 AM
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
>
}
}
Reply
Answers (
3
)
pdf file content with searching and highlight
Responsive Dynamic Menu bar in asp.net