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

Hierarchy Grid

2 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ban
Top achievements
Rank 1
Ban asked on 30 Mar 2009, 10:55 AM

Hi,
I asked before about how to add an image button to the "GroupSplitterColumn" header, and you advised me and send me the way to do that and it  was a great help, the solution was as follows :

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    {  
        if (e.Item is GridHeaderItem) 
        { 
            GridHeaderItem header = (GridHeaderItem)e.Item; 
            ImageButton imgbtn = new ImageButton(); 
            imgbtn.ID = "btnExpndAll"; 
            imgbtn.ImageUrl = "~/Images/Image1.gif"; 
            imgbtn.Click += new ImageClickEventHandler(imgbtn_Click); 
            header["column"].Controls.Add(imgbtn); 
        }  
    } 
    void imgbtn_Click(object sender, ImageClickEventArgs e) 
    { 
        RadGrid1.MasterTableView.GroupsDefaultExpanded = !RadGrid1.MasterTableView.GroupsDefaultExpanded; 
        RadGrid1.MasterTableView.Rebind(); 
    } 

the Uniquename of the "GroupSplitterColumn" as you use above is ["column"], the problem is I am using now a hierarchy Grid and I add the above statement to my "GroupSplitterColumn" but what happened is when another collapse column appear for my DetailTables an exception start to appear to me, The Exception is :-

Sys.WebForms.PageRequestManagerServerErrorException; Cannot find a cell bound to column name 'column'

and when I remove the above statement this error stop appear, so what happened !!! is there any conflict betwen the "GroupSplitterColumn" and the new DetailTables collapse  column, or I should use another Uniquename ??

Please help ...

Thanks

Ban

 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Mar 2009, 11:25 AM
Hello Ban,

You would have to differentiate between the master table rows and the detail table rows in the ItemCreated event of the grid, using the Name property or DataSource property for the GridTableViews, as the above code will check for all the columns in the grid regardless of the GridTableViews. For more information refer to the following help document:
Distinguish grid rows in hierarchy on ItemCreated/ItemDataBound

Thanks
Princy.




0
Ban
Top achievements
Rank 1
answered on 30 Mar 2009, 12:03 PM
Hi Princy,
Thank you very very much, Its work now after I separate between them by DataSource name...
I am grateful for you.

Ban
Tags
Grid
Asked by
Ban
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ban
Top achievements
Rank 1
Share this question
or