Web Page Grid Not Populating From SQL Server DB

2 posts, 1 answers
  1. Aron
    Aron avatar
    24 posts
    Member since:
    Sep 2011

    Posted 02 Jan 2013 Link to this post

    I've tried some of the examples with no success.  Here is my code for "manageDonor.cshmtl" and output.
    Code files are attached.
    Using Chrome.  a very nice grid appears on the page, but it has only a single empty line saying  "No items to display" Chrome not showing any script errors.
    Thanks
    @{
        var dbRenewal = Database.Open("RenewalDataConnection");
        var sql = "SELECT donorID, title, firstname, middlename, lastname, address, city, state ,zipcode, homephone, workphone, cellphone, email FROM donor";
        var data = dbRenewal.Query(sql);
        var json = Json.Encode(data);
        Response.Write(json);
        }     

    [{"donorID":152,"title":"title","firstname":"firstname","middlename":"Middlename","lastname":"lastname","address":"100 Main Street","city":"Los Angeles","state":"CA","zipcode":"90067","homephone":"3105528809","workphone":"3105528809","cellphone":"3105528809","email":null},{"donorID":157,"title":"Rabbi","firstname":"Yehuda","middlename":"Lein","lastname":"Smith","address":"100 Main Street","city":"Los Angeles","state":"CA","zipcode":"91678","homephone":"3105528809","workphone":"3105528809","cellphone":"3105528809","email":null}]
  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 03 Jan 2013 Link to this post

    Hello Aron,

    I have looked at the code you have provided and found the following issues related to the problem you have described:

    - You are assigning a DataSource instance as a data to another DataSource instance (donorDataSource is set as data of the dataSource). This is not valid nor supported.
    - In order to have paging when binding to remote data, the returned response should contain the a field with the total number of records. Also you should describe the response's data and total fields in the schema.

    All the best,
    Rosen
    the Telerik team
    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
Back to Top