DropDownListFor:
@Html.DropDownListFor(model => model.RoleID, new SelectList(ViewBag.Role
as System.Collections.IEnumerable,
"id", "roleName"),
"Select", new
{ id = "ddlRoles", @class = "ft-sb validate[required]" })
DropDownList:
var
listBranch = new List<SelectListItem>();
listBranch.Add(new SelectListItem
{ Text = "--Select--", Value = string.Empty });
foreach (var agents in
ViewBag.BranchList)
{
listBranch.Add(new SelectListItem
{ Text = agents, Value = agents });
}
@Html.DropDownList("ddlBranchTypeValues",
listBranch, new { @class = "ft-tb", @id = "ddlBranchTypeValues"
})
No comments:
Post a Comment