asp.net - error in for statment with html helpers -
i use following code , got error
@for (var = 0; < model.count(); i++) { <tr> if (model[i].id == viewbag.selectedid) { <td> @html.editorfor(m => m[i].name) </td> <td> @html.editorfor(m=> m[i]checkbox1) </td> ............ } </tr> }
the error in
@html.editorfor(m => m[i].name)
and
@html.editorfor(m=> m[i]checkbox1)
the error is
try specifying arguments explicitly
. problem?
update
i try following got error in check boxes,how solve it?
@foreach (var item in model) { <tr> @if (item.id == viewbag.selectedid) { <td> @html.textbox(item.name) </td> <td> @html.editorfor(item.checkbox1) </td> <td> <button type="submit" name="submit" value="save">save</button> <button type="submit" name="submit" value="cancel">cancel</button> </td> }
the error in: @html.editorfor(item.checkbox1)
i tried change @html.textbox(item.checkbox1) or @html.checkboxfor(item.checkbox1) , error remain,any idea how manage it?
instead of using loop try foreach , display each items.
for eg :
@foreach (var item in model) { <tr> <td> @html.textbox(item.name) </td> </tr> }
edit
@foreach (var item in model) { <tr> @if (item.id == viewbag.selectedid) { <td> @html.textbox(item.name) </td> <td> @html.checkbox(item.checkbox1) </td> <td> <button type="submit" name="submit" value="save">save</button> <button type="submit" name="submit" value="cancel">cancel</button> </td> }
Comments
Post a Comment