【发布时间】:2010-08-20 07:11:54
【问题描述】:
这是我对this Question..的问题扩展。
在这里我可以将下拉列表值添加到网格中.. 完美..
例如:在我的下拉列表框中,我有 A B C D 项目..
当我添加任何项目时,我正在显示网格并重新加载我的页面。
我的网格有两列,一列添加了 Dropdownlist 值..另一个是其他一些文本值..
我的网格中的每一行都有编辑按钮..
当我点击编辑时,我正在重新加载我的页面来编辑这个选定的下拉列表值..
当我单击“编辑”时,我需要在网格中显示我需要在下拉列表中显示的 Dropdownlist 值。..
让用户知道他有这个下拉值..
如果有任何机构没有解决我的问题,请告诉我..
谢谢
我的控制器代码..
public ActionResult Edit(int? id)
{
if (id.HasValue)
{
// _viewModel.ObnCategoryTextComponent = _obnRepository.GetObnCategoryById(id.Value);
var data = _obnRepository.GetSingle<ObnCategory>(id.Value);
string selectedValue = data.ObnCategoryName;
_viewModel.ServiceTypeListAll = new SelectList(_bvRepository.GetAllServiceTypes().OrderBy(n => n.ServiceTypeName), "ServiceTypeName", "ServiceTypeName", selectedValue);
// _viewModel.Category = data.ObnCategoryName;
}
return PartialView("Index",_viewModel);
}
我的观点是..
<%=Html.DropDownList("ServiceTypeListAll",Model.ServiceTypeListAll)%>
【问题讨论】:
标签: asp.net asp.net-mvc asp.net-mvc-2