Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

pass viewbag selectlistitem to razor

//viewbag with selectlist
@Html.DropDownList("AccountId", (IEnumerable<SelectListItem>)ViewBag.Accounts, null, new { @class ="form-control" })
  
// viewbag contains list<selectlistitem>  
@Html.DropDownList("mySelectList", ViewBag.SomethingSelect , "Select Something", new {@class = "form-control text-center w-75"} )  
  
 
PREVIOUS NEXT
Tagged: #pass #viewbag #selectlistitem #razor
ADD COMMENT
Topic
Name
7+8 =