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

[Solved] Calling CodeBehind with Grid Button

2 Answers 213 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe Tusing
Top achievements
Rank 1
Joe Tusing asked on 28 Jul 2009, 03:36 PM
I have a GridButtonColumn and I'm wondering if it's possible to call a method in my C# code-behind.

I have this GridButtonColumn and I tried to set the OnDeleteCommand to call my method but it's not firing.
<telerik:GridButtonColumn UniqueName="DeleteColumn" ConfirmText="Delete this Group?" ConfirmDialogType="RadWindow" 
                                        ConfirmTitle="Delete" ButtonType="ImageButton" Text="Delete" ItemStyle-HorizontalAlign="Right"   
                                        ItemStyle-Width="10px" CommandName="Delete"></telerik:GridButtonColumn> 


Delete Method I wish to call:
protected void rgAuthGroups_Delete(object source, Telerik.Web.UI.GridCommandEventArgs e) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            int groupID = Convert.ToInt32(item["idColumn"].Text);  
 
            GroupFactory.DeleteGroup(groupID); 
        } 

Is it at all possible to get this method to run after the user confirms the delete message button?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Jul 2009, 07:45 AM
Hi Joe,

I tried implementing the desired scenario on my end and it is working as expected. I am not sure what is happening on your end. Can you confirm that you have attached the DeleteCommand event handler for the Grid.

Princy


0
Joe Tusing
Top achievements
Rank 1
answered on 30 Jul 2009, 01:59 PM
Thanks for the reply Princy. I ended up putting my delete on a button in the header, deleting the selected row.
Tags
Grid
Asked by
Joe Tusing
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Joe Tusing
Top achievements
Rank 1
Share this question
or