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

finding rows and their children on clientside

2 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 2
Don asked on 06 Aug 2011, 01:59 AM
I am using RadGrid in VS2010 and populating it with JSON data from the clientside.
My page allows data entry in a traditional textfield manner and then assembles the data and performs an AJAX POST to store serverside. The page is then refreshed using a typical clientside JSON binding.
This all works well and I can have unlimted(?) number of json dataitems.

However, I need to reach inside and draw a dropdownbox for one of my cells/row.
This also works perfect until I reach the 12th row inside a foreach loop.
my javascript/clientside code is simple in that I have a loop with a counter.
inside the loop i use a RADGrid method (.getRowByIndex) to instantiate the client side object.
 ===============================================================================
var row = tableView._getRowByIndexOrItemIndexHierarchical(i); 
===============================================================================

"i" is within the bounds of my array and the row object does actually get created but the "CHILDREN" count=0.
this should represent the number of cells for that row in which I would index into that collection and then do work on the cell in question.
Error handling prevents the page from crashing and when the grid refreshes it show 12 or more rows of data but I can not access the children for any rows past the 11th one (dataItems 1-11 all have the required dropdown box, 12 and on do not)

any ideas?
(I have set the page size to 50)

Thanks Don

2 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 11 Aug 2011, 09:53 AM
Hello Don,

You cannot add server controls to the RadGrid cells client-side.

In order to implement the desired functionality, I suggest that you use a HTML select list in a similar way to the one shown in this help topic with the img.

Please give this approach a try and let me know how it goes.

Regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Don
Top achievements
Rank 2
answered on 11 Aug 2011, 05:16 PM
Thanks Mira

I should have been more explicit when I said DropdownBox: I meant the HTML equivalent <select>.

The real problem was my PageSize. The grid prerenders with row placeholders before sending it to the client so with a (default) of 10, the number of client-side rows available was 11 (Pagesize value +1)  which I could access programmatically on the client and is why the "12th" row failed.

The bottom line was that I had the PageSize value (in my case 50) set on the MasterTableView, not the RadGrid itself.
Your support team had sent me an email and playing around with their suggestions made me realize I had to move this attribute to the parent container, the RadGrid.

THANKS !
Don
Tags
Grid
Asked by
Don
Top achievements
Rank 2
Answers by
Mira
Telerik team
Don
Top achievements
Rank 2
Share this question
or