radgrid button Delete command postback not working

7 posts, 0 answers
  1. Wella
    Wella avatar
    12 posts
    Member since:
    Aug 2012

    Posted 22 Nov 2013 Link to this post

    <telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Delete" Text="&lt;img src=images/Delete.gif border=0 align=absmiddle alt='Delete Item' title='Delete record'&gt;"
                                                      UniqueName="Delete" ConfirmText="Are you sure you want to delete this record?">
                                <HeaderStyle HorizontalAlign="left" Width="10%" />
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridButtonColumn>


    here client side confirm message working but postback in not working 

    teleric version is 2008.01.0415.35
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Nov 2013 Link to this post

    Hi Wella,

    This is not an expected behavior.For the GridButtonColumn , when you set the CommandName, the appropriate events are raised. For the CommandName="Delete", the RadGrid raises the OnDeleteCommand event , you can access the values to be deleted in this event. Make sure you have attached the OnDeleteCommand event to the RadGrid.

    Thanks,
    Shinu


  3. Shashi
    Shashi avatar
    1 posts
    Member since:
    May 2017

    Posted 13 Oct 2018 in reply to Shinu Link to this post

    Still OnDeleteCommand event is not firing
  4. Tsvetomir
    Admin
    Tsvetomir avatar
    197 posts

    Posted 17 Oct 2018 Link to this post

    Hi Shashi,

    Ensure that the CommandName property of the GridButtonColumn is set to "Delete".

    <telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Delete" Text="Delete" ConfirmText="Are you sure you want to delete this record?">
    </telerik:GridButtonColumn>


    Also, ensure that you have subscribed to the OnDeleteCommand as follows:

    <telerik:RadGrid ID="RadGrid1" runat="server"  OnDeleteCommand="RadGrid1_DeleteCommand">
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID">
            <Columns>
                    <%--Ommited for brevity--%>

    Place a debugger at the OnDeleteCommand event handler and press the button. The breakpoint is hit.



    If the issue persists, consider sending us a sample project where the issue could be produced and we will debug it locally to check where does the problem stem from.

    Kind regards,
    Tsvetomir
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Jon
    Jon avatar
    1 posts
    Member since:
    Nov 2014

    Posted 08 Apr in reply to Tsvetomir Link to this post

    I am having the same problem. The OnDeleteCommand is not firing. I put a break in the code and it is never hit. Why is this? 

     

    <telerik:RadGrid RenderMode="Lightweight" runat="server" ID="RadGrid2" AllowPaging="True" AllowSorting="true"                  OnNeedDataSource="RadGrid2_NeedDataSource" OnDeleteCommand="RadGrid2_OnDeleteCommand" EnableViewState="False"  AllowAutomaticDeletes="True">     <MasterTableView DataKeyNames="ID" AutoGenerateColumns="False" >         <Columns>             <telerik:GridButtonColumn ButtonType="FontIconButton" CommandName="Delete" />             <telerik:GridBoundColumn DataField="itemName" HeaderText="Description" />             <telerik:GridBoundColumn DataField="itemPrice" HeaderText="Price" />             <telerik:GridBoundColumn DataField="itemID" Visible="False"/>         </Columns>     </MasterTableView></telerik:RadGrid>

     

     

  6. Amit
    Amit avatar
    9 posts
    Member since:
    Dec 2013

    Posted 1 day and 2 hours ago in reply to Jon Link to this post

    Is there any fix for the issue? I am facing same issue here. I have following code and its not firing the onDeleteCommand event 

     

    <telerik:GridButtonColumn ConfirmText="Delete this data?" ConfirmDialogType="RadWindow"
                                                ItemStyle-BackColor="#99ccff" ConfirmTitle="Delete" ButtonType="LinkButton" CommandName="Delete"
                                                Text="Delete" UniqueName="DeleteColumn">
                                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                                            </telerik:GridButtonColumn>

  7. Amit
    Amit avatar
    9 posts
    Member since:
    Dec 2013

    Posted 1 day and 2 hours ago in reply to Amit Link to this post

    The issue occurs only in Chrome browser in my case. It works fine on IE and Firefox browsers.
Back to Top