@(Html.Kendo().DropDownList()
.Name("ExamIDED") //The name of the dropdownlist is mandatory. It specifies the "id" attribute of the widget.
.DataTextField("ExamDateStr") //Specifies which property of the Product to be used by the dropdownlist as a text.
.DataValueField("ExamID") //Specifies which property of the Product to be used by the dropdownlist as a value.
.OptionLabel("Select Exam Date...").HtmlAttributes(new { style = "width:175px", data_value_primitive = "true" })
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetExamDate", "AptitudeTset"); //Set the Action and Controller name
})
.ServerFiltering(true); //If true the DataSource will not filter the data on the client.
})
.SelectedIndex(1) //Select first item.
)
"AptitudeTset" Controller Action returns JSON data.public ActionResult GetExamDate()
{
//Read List of Exams
List<AptitudeTestExamSelectModel> model = rep.ReadExamSelectList(); // Possibly, your database call goes here.
return Json(model, JsonRequestBehavior.AllowGet);
}
No comments:
Write comments