Reputation: 2875
I'm looping through rows and trying to make use of my DataTable Model.
<td>@Html.DisplayFor(d => d.Rows[i].ItemArray[j])</td>
Im passing in five values per Row, per ItemArray, the first two are strings, the other three are strings but are either "True" or "False". I thought DisplayFor would detect this and create a CheckBox for the boolean strings.
I get five strings. Do I need additional params?
Upvotes: 0
Views: 335
Reputation: 1038780
I thought DisplayFor would detect this and create a CheckBox for the boolean strings.
DisplayFor never creates any input fields, unless of course you write a custom template that will generate a checkbox (but I wouldn't do that). That's the whole point of display templates. It's for displaying only.
If you want to generate input fields use an editor template (Html.EditorFor
).
Take a look at how the default templates look like.
Upvotes: 3