I have tried everything! I am doing a load on demand scenario. Every time it loads the results, every selection says UNDEFINED. Here is the code:
//HERE IS THE MODEL
public class TscmisModel
{
public SelectList LoadOnDemandList { get; set; }
}
//THIS IS A PARTIAL
@model USARAFSyncMVC.Areas.Event.Models.TscmisModel
@(Html.Kendo()
.ComboBox()
.HtmlAttributes(new { style = "width: 900px" })
.Name("cbTscmis")
.Filter(FilterType.StartsWith)
.MinLength(3)
.Suggest(true)
.DataTextField("Text")
.DataValueField("Value")
.HighlightFirst(true)
.BindTo(Model.LoadOnDemandList)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("_LoadTscmisData", "Event", new { area = "Event" });
}).ServerFiltering(true);
}))
//THIS IS THE SERVER METHOD
public ActionResult _LoadTscmisData(string text)
{
TscmisModel model = new TscmisModel();
if (!string.IsNullOrEmpty(text))
{
model.LoadOnDemandList = miscRepository.LoadTscmisData(text);
return PartialView("TscmisPartial", model);
}
model.LoadOnDemandList = new SelectList(new List<SelectListItem>());
return PartialView("TscmisPartial", model);
}
//HERE IS THE MODEL
public class TscmisModel
{
public SelectList LoadOnDemandList { get; set; }
}
//THIS IS A PARTIAL
@model USARAFSyncMVC.Areas.Event.Models.TscmisModel
@(Html.Kendo()
.ComboBox()
.HtmlAttributes(new { style = "width: 900px" })
.Name("cbTscmis")
.Filter(FilterType.StartsWith)
.MinLength(3)
.Suggest(true)
.DataTextField("Text")
.DataValueField("Value")
.HighlightFirst(true)
.BindTo(Model.LoadOnDemandList)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("_LoadTscmisData", "Event", new { area = "Event" });
}).ServerFiltering(true);
}))
//THIS IS THE SERVER METHOD
public ActionResult _LoadTscmisData(string text)
{
TscmisModel model = new TscmisModel();
if (!string.IsNullOrEmpty(text))
{
model.LoadOnDemandList = miscRepository.LoadTscmisData(text);
return PartialView("TscmisPartial", model);
}
model.LoadOnDemandList = new SelectList(new List<SelectListItem>());
return PartialView("TscmisPartial", model);
}