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

[Solved] Grid expand/collapse button image

2 Answers 198 Views
Grid
This is a migrated thread and some comments may be shown as answers.
S V
Top achievements
Rank 1
S V asked on 03 Sep 2009, 11:02 AM
I'm having trouble changing the expand/collapse button image in a grid. My goal is that I would like to keep the EnableEmbeddedBaseStylesheet ja EnableEmbeddedSkins false and set only the styles I need for the grid. This works fine and as expected, it also gets rid of the original styles of the button. The problem is that I can't find a place where to set the imageurl for the button.

I have tried several different solutions:

Inside mastertableview:
<ExpandCollapseColumn ButtonType="LinkButton"  CollapseImageUrl="myfirsturl" ExpandImageUrl="mysecondurl" />

In Prerender:
dim column = TryCast(mygrid.MasterTableView.GetColumn("ExpandColumn"), GridExpandColumn)
column.ButtonType = GridExpandColumnType.ImageButton
column.ExpandImageUrl = mysecondurl
column.CollapseImageUrl = myfirsturl

In ColumnCreated:
If TypeOf e.Column Is GridExpandColumn Then
            Dim column = TryCast(e.Column, GridExpandColumn)
            column.ButtonType = GridExpandColumnType.ImageButton
            column.ExpandImageUrl = mysecondurl
            column.CollapseImageUrl = myfirsturl
End If

Nothing works. I have a feeling that I'm trying to set it 1) int the wrong sub (even though many examples use solutions above) 2) to the wrong element. So how can I change it?




2 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 04 Sep 2009, 04:01 PM
You could try the OnInit() function:
    protected override void OnInit(EventArgs e)   
    {   
        base.OnInit(e);   
        RadGrid1.MasterTableView.ExpandCollapseColumn.ButtonType = Telerik.Web.UI.GridExpandColumnType.ImageButton;   
    }   
As found in this community post



0
S V
Top achievements
Rank 1
answered on 07 Sep 2009, 06:48 AM
Hi! And thanks for the reply. Unfortunately that is not working for me.. Where should I set the images to the button? On oninit or on the grid somewhere?
Tags
Grid
Asked by
S V
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
S V
Top achievements
Rank 1
Share this question
or