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

Change the default group expand/collapse icons

2 Answers 175 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 28 Nov 2009, 03:45 PM
Hi, can anyone tell me how to configure a grid to use different images for the expand/collapse buttons?

Scenario: I'm using a grid set with a skin (Sunset) whose expand/collapse icons are not acceptable. Another skin, Office2007, has much better icons (boxed plus/minus symbols, which is an industry standard). I want to use those images without either replacing the Sunset skin images in place, defining a new custom skin, or changing which skin the grid uses.

This should be trivial and on the surface the means to do it appear to be there, but...

What I've tried (which obviously hasn't worked): I've copied the two images into my own images folder within the web app, I've changed the grid's ExpandCollapseColumn ButtonType to ImageButton, and set the CollapseImageURL and ExpandImageURL to the paths to my copies of the images (in my images folder). I've made these changes in both the top-level grid properties and in the grid's MasterTableView properties.

The result is that the e/c column still displays the icons taken from the grid's skin definition.

Thanks in advance for any help
Chris

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Nov 2009, 05:43 AM
Hi Chris,

You can set the GroupSplitterColumn images as shown below:
c#:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) 
    { 
       if (e.Column is GridGroupSplitterColumn) 
        { 
            (e.Column as GridGroupSplitterColumn).ExpandImageUrl = "Images/SinglePlus.gif"
            (e.Column as GridGroupSplitterColumn).CollapseImageUrl = "Images/SingleMinus.gif"
        } 
    } 

Thanks
Princy.
0
Chris
Top achievements
Rank 1
answered on 30 Nov 2009, 01:11 PM
Thanks Princy, I was afraid it would look like that! But it will work. Really though, all these lines of code for things that should be available declaratively...

Plus yesterday I realized that the so called "expand/collapse" column is not where the group icons appear - as your code snip shows it is actually the GroupSplitterColumn - which explains why my approach failed.

Best regards
Chris
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Chris
Top achievements
Rank 1
Share this question
or