+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Delete Command on RadGrid not working

Delete Command on RadGrid not working

4 posts, 0 answered
  1. J.R. Garcia
    J.R. Garcia avatar
    24 posts
    Registered:
    12 Aug 2008
    02 Oct 2009
    Link to this post
    We have a RadGrid on the page that looks like this:
    <telerik:RadGrid ID="ActivityRadGrid" AllowAutomaticDeletes="True" 
                         AutoGenerateColumns="False" GridLines="None" 
                         EnableEmbeddedSkins="false" OnDeleteCommand="ActivityRadGrid_DeleteCommand" 
                         OnItemDataBound="ActivityRadGrid_ItemDataBound" OnRowDrop="ActivityRadGrid_RowDrop" 
                         runat="server"

    We have a column in it that looks like this:
    <telerik:GridButtonColumn ConfirmText="Are you sure?" ConfirmDialogType="RadWindow" 
                ButtonType="LinkButton" ItemStyle-CssClass="gridActions delete" CommandName="Delete" /> 

    We have an event in the code-behind:
    protected void ActivityRadGrid_DeleteCommand(object source, GridCommandEventArgs e) 
            var activityID = GetActivityId(e.Item); 
            DeleteActivity(activityID); 


    The problem is that this event never gets called. If you set a break point in the event, it never gets to it. I've even replaced the GridButtonColumn with a TemplateColumn with a LinkButton and the event on that never gets hit. Does anyone know what might cause this to happen?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Oct 2009
    Link to this post
    Hello J.R. Garcia,

    Please check whether AutoEventWireup is set to true. You could also try subscribing for the event on Page Load event. Below is a sample  code:

    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" GridLines="None" Skin="Black" AllowPaging="true" PageSize="20"
    <MasterTableView> 
     <Columns> 
          <telerik:GridButtonColumn CommandName="Delete" Text="Delete" 
          UniqueName"DeleteColumn" /> 
         <telerik:GridBoundColumn DataField="Subject"  HeaderText="Subject"/> 
         <telerik:GridBoundColumn DataField="Status"  HeaderText="Status"/> 
         <telerik:GridBoundColumn DataField="Content"  HeaderText="Content"/>  
         <telerik:GridBoundColumn DataField="DateCreated"  HeaderText="DateCreated"/>   
     </Columns> 
    </MasterTableView> 
    </telerik:RadGrid> 


     protected void Page_Load(object sender, EventArgs e) 
        { 
     
          RadGrid1.DeleteCommand += new GridCommandEventHandler(RadGrid1_DeleteCommand); 
        } 
     


     void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e) 
        { 
            throw new NotImplementedException(); 
        } 

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. J.R. Garcia
    J.R. Garcia avatar
    24 posts
    Registered:
    12 Aug 2008
    06 Oct 2009
    Link to this post
    The problem ended up being that one of the other developers on the team was databinding in an unusual place. This isn't a problem with the RadControls or Sitefinity.

    Thanks,
    J.R. Garcia
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    06 Oct 2009
    Link to this post
    Hello J.R. Garcia,

    Thank you for getting back to us. It is good to hear the the issue does not come from our source and everything is working fine at your end.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered