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

[Solved] Displaying DetailTable in RadGrid

4 Answers 170 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anu
Top achievements
Rank 1
Anu asked on 03 Apr 2009, 11:06 AM
Hi,

I am using 2 level heirarchy in my radgrid. The detail table is displayed with the click of an expansion sign (I guess it depends on the skin) we are using. Is there any way I can add a text to this column such as 'Select' so that it is more visible to the user.

Also, is it possible that the detail table gets displayed by selecting anywhere on the row?

I really appreciate any help!

regards,

Anu

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Apr 2009, 12:26 PM
Hi Anu,

One suggestion will be to hide the Expand/Collapse column and use a GridButtonColumn so that you can set the Text and CommandName of the GridButtonColumn . You can try the following code snippet to achieve the desired scenario.

CS:
 
<telerik:GridButtonColumn Text="Select" CommandName="ExpandCollapseItem" ></telerik:GridButtonColumn> 


CS:
 
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
    {  
        if (e.CommandName == "ExpandCollapseItem")  
        {  
            GridDataItem item = (GridDataItem)e.Item;  
            item.Expanded = !item.Expanded;  
        }  
    }  


Thanks
Shinu
0
Anu
Top achievements
Rank 1
answered on 03 Apr 2009, 12:30 PM
Hi Shinu,

Thanks for your answer. How do I hide the default Expand/Collapse Column?

many thanks,

Anu
0
Princy
Top achievements
Rank 2
answered on 03 Apr 2009, 04:51 PM
Hello Anu,

Try the following code snippet in the PreRender event for hiding the expand/collapse column in hierarchical Grid.

CS:
 
RadGrid1.MasterTableView.GetColumn("ExpandColumn").Display = False  

Refer the following link also.
Preventing groups expansion by hiding the expand/collapse images 

Thanks,
Princy.
0
Anu
Top achievements
Rank 1
answered on 06 Apr 2009, 11:34 AM
Hi Shinu,

Thanksagain for your reply. I tried it and it is working! great!

I have another question, if you don't mind...

In the event handler, RadGrid1_ItemCommand(...), I tried to change the display text depending on whether the row is expanded or not. But, unfortunately, once I change the text, it does not work as a link any more. I mean instead of a buttoncolumn with an underlined text (as a link), the cell just displays the text only.... Can you think of any reason for this?

many thanks,


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