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

[Solved] How to find "GridEditCommandColumn ButtonType..."

1 Answer 270 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul Singh
Top achievements
Rank 1
Rahul Singh asked on 28 Oct 2009, 07:31 AM
Hi All,

How to find the "ImageButton" in the code block below from code behind page ? Code block below is part of rad grid html code in aspx file.

<rad:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../Images/editItem.gif">
                                        <HeaderStyle Font-Bold="True" Wrap="False" />
                                        <ItemStyle Wrap="true" />
                                    </rad:GridEditCommandColumn> 

Also after finding this button, i need to write some code on click event of this button in GridEditCommandColumn . So which event i should use for this ?


Thanks in advance
Rahul

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Oct 2009, 08:03 AM
Hello Rahul,

You can access the edit imagebutton in the ItemCreated event of the grid and then attach an event handler for the imagebutton as shown below:
c#:
protected void RadGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            ImageButton imgbtn = (ImageButton)dataItem["EditCommandColumnUniqueName"].Controls[0]; 
            imgbtn.Click += new ImageClickEventHandler(imgbtn_Click); 
        } 
 
    } 
 
    void imgbtn_Click(object sender, ImageClickEventArgs e) 
    { 
       // custom code 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Rahul Singh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or