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

Changing editcolumn icon image

2 Answers 356 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dick
Top achievements
Rank 1
Dick asked on 19 Sep 2008, 06:24 PM
I need to be able to change the default pencil icon of the RadGrid to a custom Icon when a user is defined to the system as read only. 

Using the following piece of code in the  " protected void Page_Load(object sender, EventArgs e) " function, I can hide the column with the visible property set to false. 
      
     RadGrid1.MasterTableView.GetColumn(
"EditImageColumn").Visible = false;

However what I need to do is change the pencil image to eyeglasses (indicating read-only mode).

The EditImageUrl property is not available using the above code and replacing the ".Visible" with ".EditImageUrl". It results in a compile error.

    RadGrid1.MasterTableView.GetColumn("EditImageColumn"). EditImageUrl = "~/MyImage" 

How can I accomplish this requirement.

Thanks

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Sep 2008, 05:12 AM
Hi Dick,

Try accessing the GridEditCommandColumn in the PreRender event and set the image url for the edit column as shown below.

CS:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) 
        { 
            if (col.ColumnType =="GridEditCommandColumn") 
            { 
                GridEditCommandColumn editcol = (GridEditCommandColumn)col; 
                editcol.EditImageUrl = "Images/Image1.gif"
            } 
        } 
        RadGrid1.Rebind(); 
         
    } 


Thanks
Shinu.
0
Dick
Top achievements
Rank 1
answered on 22 Sep 2008, 01:08 PM
Thanks for your response.
Tags
Grid
Asked by
Dick
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dick
Top achievements
Rank 1
Share this question
or