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

Master/Detail table view and View State

1 Answer 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Himalay
Top achievements
Rank 1
Himalay asked on 22 Jul 2011, 08:05 PM
Hi,

Given:
- I have an AjaxControlToolKit TabPanel.
- I have a radgrid in a tab with Master Table and Detail Table views. I am using Client hierarchy mode.
- I have having a dropdown in master table ItemTemplate. A selected index changed event is handled in code behind.
- I have a textbox in detailtable ItemTemplate. A javascript function is called on click of the textbox where I send textbox's Client ID. Inside the javascript function, I use document.getElementById() to get the DOM object of textbox.

Problem:
- When grid loads for the first time, everything works fine. I expand child items, click on texboxes and document.getElementById() gets me the textbox object.
- But when I click on dropdown, change the selected item and the grid loads back.
- Now when I open a child item and click on textbox, document.getElementById() throws a null reference error.
- I checked the viewsource, I was able to find the textox with id. But document.getElementById() is not able to locate it.

I believe this has something to do with Ajax and viewstate of DetailTable views but I dont know where the problem. Please help me pinpoint the issue and find a solution.

Regards,
Himalay

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 27 Jul 2011, 04:23 PM
Hello Himalay,

By default when you rebind a parent table in hierarchical grid the settings/expanded state for the nested tables will be lost. This is because the refresh action resets all previous settings applied for the nested controls to avoid viewstate inconsistencies/unexpected behavior.

Please examine the project in the code library below which represents how to retain the expanded/selected state for grid items in hierarchy upon a rebind command and see if it works for you:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/retain-expanded-selected-state-in-hierarchy-on-rebind.aspx

Greetings,
Pavlina
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.

Tags
Grid
Asked by
Himalay
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or