I have a DDL (below that is not binding to my controller (also below). The contact controller/View are part of an area.
Please assist.
Thanks in advance
Controller
public ActionResult GetCountries([DataSourceRequest] DataSourceRequest dsRequest)
{
List<DropDownListModel> result = new List<DropDownListModel>();
foreach (DataRow dr in CommonWf.getLocationByTypeId(4).Tables[0].Rows)
{
if (!string.IsNullOrEmpty(dr["Name"].ToString()))
{
DropDownListModel returnModel = new DropDownListModel();
returnModel.Name = dr["Name"].ToString();
returnModel.Value = dr["LocationId"].ToString();
result.Add(returnModel);
}
}
DataSourceResult crapData = result.ToDataSourceResult(dsRequest);
return Json(crapData, JsonRequestBehavior.AllowGet);
}
Dropdown List
@(Html.Kendo().DropDownList()
.Name("CountryId")
.DataTextField("Name")
.DataValueField("Value")
.Events(e =>
{
e.Select("onChangeCountry"); //.DataBound("onCountryBound");
})
.OptionLabel("Select Country...")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCountries", "Contact");
})
.ServerFiltering(true);
})
)