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

Client-side object creation order

2 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ivaylo
Top achievements
Rank 1
Ivaylo asked on 29 Nov 2010, 10:20 AM
Hi,
I am sorry if I am repeating an existing question, but can you tell me what is client side creation order of the objects that represent rad controls, especially those inside a RadGrid. I need to know if a RadGrid control that contains Rad controls inside its ItemTemplate will fire its RowCreated event after the creation of the clientside objects inside that particular row. Or is there an event I can hook up to, that will always get fired after the grid and the controls inside have been created on the client. Can you clarify also if this ordrer of creation is somehow altered after an AJAX request caused by RadAjaxManager. My goal is to have an event where I can walk through the grid control and get the controls inside each item and make some additional client-side configuration on them - therefore I need them all to be created and the .get_element() methods to point to a valid markup.
Any help on this topic is well appreciated.

2 Answers, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 29 Nov 2010, 06:25 PM
Hi Ivaylo,

Controls inside the ItemTemplate of grid columns will be have their client-side objects instantiated when the AJAX client framework loads. This will be right after RadGrid initializes, as RadGrid is a parent control that is instantiated earlier. Grid rows, on the other side, do not have their client-side objects created immediately after page load. GridDataItem client objects are initialized the first time you access the items collection on the client:

var grid =$find("RadGridClientID");
var items = grid.get_masterTableView().get_dataItems();
//this is where items will be initialized

This also means RadGrid's OnRowCreated event will be fired at this point. That said, you can force instantiation of grid items any time after AJAX by calling the data items getter as shown above. Controls inside items will have already been initialized, so you can use the OnRowCreated event for accessing them.

All the best,
Veli
the Telerik team
Browse the vast support resources we have to jumpstart 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
Ivaylo
Top achievements
Rank 1
answered on 30 Nov 2010, 10:24 AM
OK, for me the approach with looping through the data items inside the pageLoad() methods worked perfectly, as it is guaranteed that the code will be executed on every load (inlcuding ajax requests).
Thanks
Tags
Grid
Asked by
Ivaylo
Top achievements
Rank 1
Answers by
Veli
Telerik team
Ivaylo
Top achievements
Rank 1
Share this question
or