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

[Solved] How to set images for expandcollapsecolumn?

4 Answers 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
peerapat
Top achievements
Rank 1
peerapat asked on 12 May 2009, 03:46 PM
WIthout setting anything I've got arrow for expandcollapsecolumn. I want to have minus/plus image for this column like in your live examples. I try to change

CollapseImageUrl

 

="/images/minus.gif" ExpandImageUrl="/images/plus.gif" pointing to images in my local,but Nothing happens.


 

 

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 14 May 2009, 03:42 PM
Hi Peerapat,

I suggest that you add OnColumnCreated event for the grid and put the code snippet bellow for giving the expand/collapse image url at run time.

C#:
if (e.Column is GridExpandColumn)     
            {     
                (e.Column as GridExpandColumn).ButtonType = GridExpandColumnType.ImageButton;     
                (e.Column as GridExpandColumn).ExpandImageUrl = "~/App_Themes/images/SinglePlus.gif";     
                (e.Column as GridExpandColumn).CollapseImageUrl = "~/App_Themes/images/SingleMinus.gif";     
            } 

I hope this helps.

Kind regards,

Pavlina
the Telerik team

 


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
peerapat
Top achievements
Rank 1
answered on 19 May 2009, 04:20 AM
Dear Pavlina,
    This really works. I wonder why setting at design time doesn't. Anyway, thank you very much. One more question on this, how can I set mouse pointer to hand. Do I have to set CSS class?

Best regards,
0
Princy
Top achievements
Rank 2
answered on 19 May 2009, 04:45 AM
Hello Peerapat,

The cursor style should appear to be a pointer for the imagebutton in the ExpandColumn. I'm not sure as to why it does not work in your case but you could probably try out the following code to set the cursor style for the ExpandColumn images:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridDataItem)  
        {     
            GridDataItem item = (GridDataItem)e.Item; 
            ImageButton imgbtn = (ImageButton)item["ExpandColumn"].Controls[0];  
            imgbtn.Attributes.Add("onmouseover""this.style.cursor = 'pointer';");  
        }  
    }  
 

Thanks
Princy.
0
peerapat
Top achievements
Rank 1
answered on 19 May 2009, 05:12 AM
thank you very much for you quick resonse. Your code threw an error on line "ImageButton imgbtn = (ImageButton)item["ExpandColumn"].Controls[0];  "

Best regards,
Tags
Grid
Asked by
peerapat
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
peerapat
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or