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

[Solved] Problem with the DetailTables in my solution

3 Answers 138 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Francisco
Top achievements
Rank 1
Francisco asked on 23 Jun 2009, 01:36 PM
Hi,

I'm creating a grid dynammically on Page_Init event and using a placeholder declared in my html code. When the page load first time, the grid, the columns, the datasource are created perfectally. When I do a new ajax request (like perfoming a filter), the grid is created like expected on Page_Init (defining all structure like described in telerik online demos), but when the DetailTableDataBind event is called the grid comes with its structure changed. Example, first time the page inits I create a grid with the following structure (on Page_init event):

- MasterTableView
---- DetailtTable 1
-------- DetailTable 1.1
-------- DetailTable 1.2
-------- DetailTable 1.3

After performing a filter (the second load), the grid must be created like this:

- MasterTableView
---- DetailtTable 1
-------- DetailTable 1.1

I follow the code in debug and it is created ok. But when the code enter in DetailTableDataBind event, the grid changed its structure and back to the first structure:

- MasterTableView
---- DetailtTable 1
-------- DetailTable 1.1
-------- DetailTable 1.2
-------- DetailTable 1.3

The instance of the grid is the same (before and after the the DetailTableDataBind event). In don't know why it is ignoring my modifications on the grid structure at Page_Init event. Another problem is when calling the DetailTableDataBind event the Name property is empty even when I set its value (after the first page request).

Thanks.



3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 24 Jun 2009, 01:18 PM
Hi Francisco,

Keep in mind that when creating a grid in the Page_Init event handler, you can use the Page_Load event to add an AJAX setting for the grid to a RadAjaxManager so that the grid uses asynchronous callbacks.
More information is available in the following articles:
Programmatic creation (Create hierarchical grid programmatically section)
Programmatic creation on PageInit - Demo

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Francisco
Top achievements
Rank 1
answered on 29 Jun 2009, 01:56 PM
I read the documentation but I still have the same problem.

I'm creating a grid entirely by code on Page_Init. My grid changes its structure (number of tableviews and hierarchy) on each postback. This is based on datasource.

P.S: I can't use the Selfhierarchy settings approach because my datasource has two types of objects.

The fact is that when I postback (i.e: clicking on the expand collapse button), the Page_Init event will create and modify the grid (number of tableview changes and the tableview name property too). After the Page_init and the Page_Load, the event DetailTableDatabind is called but the name property is empty.

I'm using a RadAjaxManager and registering the grid in the ajaxsettings already.

On the same postback, I don't understand why  the property name of the GridTableView is coming empty (at DetailTableDatabind event) even if I set it on the Page_Init.

Thanks.
0
Pavlina
Telerik team
answered on 30 Jun 2009, 04:34 PM
Hello Francisco,

In the code of the DetailTableDataBind event handler you should write code for constructing detail data-source (list of objects) that will be used by the table to be bound to the hierarchical structure. The DataSource should be filtered in the appropriate manner, it should contain only child-records of the parent item is bound to.

Please find more information about the main steps when binding your grid instance to hierarchical data source through the DetailTableDataBind event in this online demo.

I hope this helps.

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Francisco
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Francisco
Top achievements
Rank 1
Share this question
or