<table>
<tr>
<td>
<span>Account Type Name</span>
</td>
<td>
@Html.DropDownListFor(model => model.AccountTypeId, new SelectList( ViewBag.AccountTypes, "value", "text"))
</td>
</tr>
</table>
public ActionResult AddEditView(string accountSubTypeID)
{
AccountSubTypeModel accountSubTypeModel = new AccountSubTypeModel();
if (!string.IsNullOrEmpty(accountSubTypeID))
{
accountSubTypeModel = _subTypeService.SingleOrDefault(new Guid(accountSubTypeID));
}
this.LoadDDL(accountSubTypeModel);
return PartialView(accountSubTypeModel);
}
private void LoadDDL(AccountSubTypeModel accountSubTypeModel)
{
var accountTypes = _typeService.GetDropDownData("Id", "TypeName");
var selectList = new SelectList(accountTypes, "Value", "Text", accountSubTypeModel.AccountTypeId);
ViewBag.AccountTypes = selectList;
}
<tr>
<td>
<span>Account Type Name</span>
</td>
<td>
@Html.DropDownListFor(model => model.AccountTypeId, new SelectList( ViewBag.AccountTypes, "value", "text"))
</td>
</tr>
</table>
public ActionResult AddEditView(string accountSubTypeID)
{
AccountSubTypeModel accountSubTypeModel = new AccountSubTypeModel();
if (!string.IsNullOrEmpty(accountSubTypeID))
{
accountSubTypeModel = _subTypeService.SingleOrDefault(new Guid(accountSubTypeID));
}
this.LoadDDL(accountSubTypeModel);
return PartialView(accountSubTypeModel);
}
private void LoadDDL(AccountSubTypeModel accountSubTypeModel)
{
var accountTypes = _typeService.GetDropDownData("Id", "TypeName");
var selectList = new SelectList(accountTypes, "Value", "Text", accountSubTypeModel.AccountTypeId);
ViewBag.AccountTypes = selectList;
}
No comments:
Post a Comment