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

[Solved] DetailTable not showing data

3 Answers 227 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 19 Apr 2013, 11:54 AM
Hello,
In my code in Radgrid_Init I am declaring detailTables by:

                    GridTableView tableViewLevel = new GridTableView(Radgrid);
                    tableViewLevel.HierarchyLoadMode = GridChildLoadMode.ServerOnDemand;
                    tableViewLevel.AutoGenerateColumns = false;

                    Radgrid.MasterTableView.DetailTables.Add(tableViewLevel);

so I can open DetailTables (I have image in first column).

Then on Radgrid_DetailTableDataBind I'm clearing data by:

            Radgrid.MasterTableView.DetailTables.Clear();

and again declaring:

            GridTableView tableViewLevel = new GridTableView(Radgrid);
            tableViewLevel.HierarchyLoadMode = GridChildLoadMode.ServerOnDemand;
            tableViewLevel.AutoGenerateColumns = false;

and then declaring some columns headers for my detailTable and adding them:

            Radgrid.MasterTableView.DetailTables.Add(tableViewLevel);

after that I have some operations to get table from SQL and I'm setting dataSource by:

                e.DetailTableView.DataSource = table;

I think this should work, however I'm getting empty DetailTables in the view. When I set property AutoGenerateColumns to true data appers.

Any idea what I'm doing wrong?

I should add that I want to dynamically set columns in Radgrid_DetailTableDataBind, because there are more than 1 Detailtable linked to 1 row in Mastertable. In Radgrid_DetailTableDataBind i'm checking which one was selected (in tooltip linked to expand/collapse imapge) and setting the right sql table. When every detailtable was declared in Radgrid_Init there was several request to Radgrid_DetailTableDataBind and Grid was working slow.

3 Answers, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 19 Apr 2013, 05:29 PM
this is just a stab in the dark - but do you have keys specified - and the connection from the detail table to the higher table?
0
Adam
Top achievements
Rank 1
answered on 22 Apr 2013, 06:49 AM
The connection from the detail table to the higher table exists :
Radgrid.MasterTableView.DetailTables.Add(tableViewLevel); - doesn't it cover the connection?
What do you mean about keys specified?
What's weird, whena I debug my code and get to the :
e.DetailTableView.DataSource - the data are in this property, however they are not displayed.
Is there a way to declar on client side which row will have detailTable (the first row on the left side with expande/colapse little triangle)? If there is such function I could write my own ajax function and it would fix my problem.
0
Elliott
Top achievements
Rank 2
answered on 22 Apr 2013, 01:54 PM
the usual way to "attach" a detail table to a parent is for them to share the same key - the primary key on the detail table, a foreign key (or the equivalent of) on the parent
I only mentioned keys because I have not been able to see a detail table because the keys weren't correctly specified - it was something I would check
Tags
Grid
Asked by
Adam
Top achievements
Rank 1
Answers by
Elliott
Top achievements
Rank 2
Adam
Top achievements
Rank 1
Share this question
or