The Data option of the Read function not working in ListView

3 posts, 0 answers
  1. Paul
    Paul avatar
    9 posts
    Member since:
    May 2013

    Posted 03 Jul 2013 Link to this post

    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
            .DataSource(source =>
                  source.Read(read =>
                         read.Action("BuildSelectList", "ProgramManager", new { list = "Tables" });
           .Events(e =>
          .DataSource(dataSource =>{
                       dataSource.Model(model => model.Id("AdminFieldId"));
                        dataSource.Read(read => read.Action("_Read", "ProgramManager").Data("GetTable"));
    The javascipt

    function Combo_onChange(e) {
       function GetTable() {
           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));
  2. Nikolay Rusev
    Nikolay Rusev avatar
    2285 posts

    Posted 04 Jul 2013 Link to this post

    Hello Paul,

    You should return the additional data as a object in order to be properly parsed on server. See the code snippets here for more details.

    In your case it should be as follow:

    function GetTable() {
     var table = (reportTablesCombo != null  ? reportTablesCombo.text() : "");
     return {
       table: table

    Nikolay Rusev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Paul
    Paul avatar
    9 posts
    Member since:
    May 2013

    Posted 08 Jul 2013 Link to this post


    Thank you very much, that did the trick

Back to Top