Can anyone tell me ? how to get data from database and bind dropdown to grid.
WebGrid grid = new WebGrid(ViewBag.room);
@grid.GetHtml(tableStyle: "table table-bordered",
mode: WebGridPagerModes.All,
columns: grid.Columns(
grid.Column("Room Type", format:@item=>Html.DropDownList("TypeID", new SelectList(ViewBag.room, "TypeID", "TypeID"), new { @class = "form-control", id = "TypeID" }))
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Chittaranjan SwainRank #216 · 11.3K reputationPosted Aug 13, 2019, 11:31 PM EDT