Change the default group expand/collapse icons

3 posts, 0 answers
  1. Chris
    Chris avatar
    9 posts
    Member since:
    Feb 2009

    Posted 28 Nov 2009 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chris
    Chris avatar
    9 posts
    Member since:
    Feb 2009

    Posted 30 Nov 2009 Link to this post

    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
Back to Top