I have a combobox and a list view on a page. When ever an item is selected in the combo box it is suppose to load the listview with items from a table with the selected criteria. No matter what the data is not passed to the read method in the controller
The View
The javascipt
the Read method in the controller. I have the debugger going and it returns the proper string but when it is read in the controller the value is ALWAYS null.
What am I doing wrong here?
The View
@(Html.Kendo().ComboBox()
.Name("reportTablesCombo")
.HtmlAttributes(userControlAttributes)
.DataTextField("Text")
.DataValueField("Value")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("BuildSelectList", "ProgramManager", new { list = "Tables" });
});
})
.Events(e =>
{
e.Change("Combo_onChange");
})
)
@(Html.Kendo().ListView(Model)
.Name("fieldListView")
.ClientTemplateId("template")
.TagName("div")
.Editable()
.DataSource(dataSource =>{
dataSource.Model(model => model.Id("AdminFieldId"));
dataSource.Read(read => read.Action("_Read", "ProgramManager").Data("GetTable"));
dataSource.PageSize(10);
})
.Pageable()
)
function
Combo_onChange(e) {
listdata.dataSource.read();
}
function
GetTable() {
debugger;
var
table = (reportTablesCombo !=
null
? reportTablesCombo.text() :
""
);
return
table;
}
the Read method in the controller. I have the debugger going and it returns the proper string but when it is read in the controller the value is ALWAYS null.
What am I doing wrong here?
public
ActionResult _Read([DataSourceRequest]DataSourceRequest request,
string
table)
{
var results = appDb.AdminFields.Where(t => t.AdminTableName == table);
return
Json(results.ToDataSourceResult(request));
}