How to get dynamic data into grid with dropdown using mvc

Aug 14 2019 12:32 AM
Can anyone tell me ? how to get data from database and bind dropdown to grid. 
WebGrid grid = new WebGrid(;
<div class="box box-primary" style="width:99.5%">
<div Style="Overflow:Auto ;max-height:200px;">
@grid.GetHtml(tableStyle: "table table-bordered",
mode: WebGridPagerModes.All,
columns: grid.Columns(
grid.Column("Room Type", format:@item=>Html.DropDownList("TypeID", new SelectList(, "TypeID", "TypeID"), new { @class = "form-control", id = "TypeID" }))

Answers (1)