2X faster development
The ultimate ASP.NET MVC UI toolkit to boost your development speed.
DescriptionBinding the list items as JSON data to the DropDownList from the client side.
SolutionYou can bind the list of values into the DropDownList by using the dataSource property of the DropDownList. This is explained in the following code example.
CSHTML @Html.EJ().DropDownList(“bikeList”).DropDownListFields(df => df.ID(“empid”).Text(“text”)).ClientSideEvents(e => e.Create(“onCreate”)) <script> function onCreate() { BikeList = [ { empid: “bk1”, text: “Apache RTR” }, { empid: “bk2”, text: “CBR 150-R” }, { empid: “bk3”, text: “CBZ Xtreme” }, { empid: “bk4”, text: “Discover” }, { empid: “bk5”, text: “Dazzler” }, { empid: “bk6”, text: “Flame” }, { empid: “bk7”, text: “Fazzer” }, { empid: “bk8”, text: “FZ-S” }, { empid: “bk9”, text: “Pulsar” }, { empid: “bk10”, text: “Shine” }, { empid: “bk11”, text: “R15” }, { empid: “bk12”, text: “Unicorn” } ]; var data1 = $(“#bikeList”).data(“ejDropDownList”); //initializes the Dropdownlist. data1.option(“dataSource”, BikeList); } </script>
|
2X faster development
The ultimate ASP.NET MVC UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.