asp.net mvc中单行的formcollection [英] formcollection for a single row in asp.net mvc
本文介绍了asp.net mvc中单行的formcollection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
@using (Html.BeginForm("Assign", "Users"))
{
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.GroupId)
</th>
<th>
@Html.DisplayNameFor(model => model.OfficeNameAr)
</th>
<th>
@Html.DisplayNameFor(model => model.OfficeNamrEn)
</th>
<th>
@Html.DisplayNameFor(model => model.DIRCODE)
</th>
<th>
@Html.DisplayNameFor(model => model.FinanceAccountNo)
</th>
<th>
@Html.DisplayNameFor(model => model.City.CityNameAr)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.GroupId)
@Html.HiddenFor(modelItem => item.GroupId)
</td>
<td>
@Html.DisplayFor(modelItem => item.OfficeNameAr)
</td>
<td>
@Html.DisplayFor(modelItem => item.OfficeNamrEn)
</td>
<td>
@Html.DisplayFor(modelItem => item.DIRCODE)
</td>
<td>
@Html.DisplayFor(modelItem => item.FinanceAccountNo)
</td>
<td>
@Html.DisplayFor(modelItem => item.City.CityNameAr)
</td>
<td>
@Html.DropDownList("RightId", ViewBag.rights as SelectList)
</td>
<td>
@*@Ajax.ActionLink("Assign", "Assign", new { groupid = item.GroupId }, new AjaxOptions { HttpMethod = "POST" })*@
<input type="submit" name="Assign" />
</td>
</tr>
}
</table>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
当我点击一个按钮时,它转到用户控制器中的assign动作,并获取formcollection对象中的值。问题是,当我点击一个按钮时,组ID值变为逗号删除字符串,而我只想仅仅检索实际点击按钮的一行。
希望你能理解并期待回复
when i click a button it goes to the assign action in users controller, and am getting the values in formcollection object. The issue is when i click a button the group id values are becomes comma deletemeted strings, instead i just want to retreive only one row of where the button was actually clicked.
Hope you can understand and expecting the replies
推荐答案
这篇关于asp.net mvc中单行的formcollection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文