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

Grid Hierarchy ?

3 Answers 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason Bourdette
Top achievements
Rank 1
Jason Bourdette asked on 15 May 2010, 09:59 PM
I have a grid and I have added a Hierarchy which is working good but I was wondering if there is a way to selectively show the expand grid button based on content in a column.

For example if my first column is an order number and I want to have a nested Hierarchy but only for order numbers in the column that begin with a certain text string.

thx
jason

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 May 2010, 05:36 AM
Hello Jason,

Try the following code snippet to show/hide expand grid button based on the content in a column.

C#:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            if (item["OrderID"].Text == "10249")//your condition 
            { 
                TableCell cell = item["ExpandColumn"]; 
                cell.Controls.Clear(); 
            } 
        } 
    } 

Regards,
Shinu.



0
Jason Bourdette
Top achievements
Rank 1
answered on 27 May 2010, 08:11 PM
Just getting back around to looking at this code, and I see what it is doing but this is not exactly what i had in mind. I want to effect a nested grid not the top level grid.

is there something like RadGrid1.DetailsTableView.Items  (this didnt work but is there something like it?)

thanks
0
Radoslav
Telerik team
answered on 31 May 2010, 02:06 PM
Hello Jason,

Please check out the following online documentation article which explains how to hide expand/collapse images when no records:
http://www.telerik.com/help/aspnet-ajax/grdhideexpandcollapseimageswhennorecords.html

You could modify the code snippets and hide expand/collapse buttons based on content in a column:

I hope this helps.

Sincerely yours,
Radoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Jason Bourdette
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jason Bourdette
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or