ashr
unread,Oct 5, 2011, 8:50:13 AM10/5/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mvccontrib-discuss
Hi guys
I'd like to be able to use model binding inside the grid. Is this a
feature that you might be adding or should I rather look at other
solutions like partial views in a loop ?
Example:
@Html.Grid(Model.ImmovableProperty).Columns(
column =>
{
column.Custom(
@<text>
<div id="assetForm">
<fieldset>
<div id="assetFormRow">
<label for="assetTypeDropdown">Asset type</label>
@Html.DropDownList("typeOfAssetIdDropdown" +
@item.assetDetail.id.ToString(), new SelectList(Model.TypeOfAssetData,
"Key", "Value", @item.assetDetail.typeOfAssetId))
@Html.ValidationMessage("typeOfAssetId")
</div>
<div id="assetFormRow">
<input type="submit" value="Edit" name="editClient1" />
</div>
</fieldset>
</div>
</text>
);
}).Attributes(@class => "", @id => "")
The code above works fine, but I can't do *For model binding methods
like @Html.DropdownListFor and .TextboxFor etc. So my model is not
bound to the form and I cannot get changed values back to my
controller in an easy to use non-spaghetti way.
Thanks in advance, I hope I was clear enough.