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

[Solved] Null template row for client-bound webservice

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lawrence Sin
Top achievements
Rank 1
Lawrence Sin asked on 26 Aug 2009, 04:59 PM
Hi everyone.  I am having an issue with the Webservice binding client binding example here: http://demos.telerik.com/aspnet-ajax/grid/examples/client/livedata/defaultcs.aspx.  It works fine up to 10 rows of data, but anything after 10 rows the elements inside the template column come back as null when trying to get the object via javascript.

You can reproduce this by opening up the sample web site up in visual studios and then adding a couple more stock tickers to the App_Code/Grid/QuoteWebService.cs web service. 
// Lines 48 and 92 
string stockTickers = "MSFT, YHOO, GOOG, HPQ, DELL, AAPL, NOVL, IBM, IBN, IBKR, INO, AMAT, BAC, CIT, DIS, EBAY"

Then view the Grid/Examples/Client/LiveData/DefaultCS.aspx in a web browser and you will see that it errors on the 11th row saying that it cannot find the image element inside of the template column.

Both of the spanControl and image returns null in the DefaultCS.aspx page.
var spanControl = args.get_item().get_cell("Change").getElementsByTagName('span')[0]; 
var image = args.get_item().get_cell("Change").getElementsByTagName('img')[0]; 

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 01 Sep 2009, 07:22 AM
Hello Lawrence,

You need to increase the page size (RadGrid1.MasterTableView.PageSize) of the grid to the number of rows in the dataset - in your case 16. This is necessary since the controls in the template columns are rendered on the server and if the page size is not specified explicitly the grid renders on the server only 10 rows by default and hence only the first 10 rows will have the controls in their template columns created on the server and rendered in the browser.

I hope this helps.

All the best,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Lawrence Sin
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or