This is a migrated thread and some comments may be shown as answers.

Web Page Grid Not Populating From SQL Server DB

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aron
Top achievements
Rank 1
Aron asked on 02 Jan 2013, 02:21 PM
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}]

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 03 Jan 2013, 08:23 AM
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!
Tags
Grid
Asked by
Aron
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or