Delete Confirmation

2 posts, 1 answers
  1. BRK
    BRK avatar
    35 posts
    Member since:
    Jun 2012

    Posted 12 Nov 2011 Link to this post

    Hi All,

    I have generated a RadGrid using a table. Code below is
    While delete I need confirmation.
    For that I have added confirmationtext usingtelerik:GridButtonColumn But it is not deleting. Only it is howing a message box. So what code we need to put in code-behind or aspx page to do deletions. Tell me some suggestions

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True"             
                ShowStatusBar="True" AllowPaging="True" Skin="Office2007"
                AutoGenerateDeleteColumn="True" AutoGenerateColumns="False" AllowFilteringByColumn="True"
                DataSourceID="SqlDataSource5" GridLines="None" Width="520px"
    AllowAutomaticUpdates="True" AllowAutomaticInserts="True" AutoGenerateEditColumn="True">
                <MasterTableView DataSourceID="SqlDataSource5" AllowAutomaticUpdates="True"
                     CommandItemDisplay="Top"  DataKeyNames="ID" AllowAutomaticInserts="true">
                        <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID"
                            UniqueName="ID" DataType="System.Int32" ReadOnly="True" Visible="false"  />
                        <telerik:GridBoundColumn DataField="Class" HeaderText="Class" SortExpression="Class"
                            UniqueName="Class" />                   
                        <telerik:GridBoundColumn DataField="Course"
                            HeaderText="Course" SortExpression="Course" UniqueName="Course" AllowFiltering="false">
                        <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this row or record?"
                        CommandName="Delete" Text="Delete">
                        <%--<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                        <HeaderStyle HorizontalAlign="Center" />
                        <asp:SqlDataSource ID="SqlDataSource5" runat="server"
                            ConnectionString="<%$ ConnectionStrings:SearchingConnectionString %>"
                            DeleteCommand="DELETE FROM [Clas_Course] WHERE [ID] = @ID"
                            InsertCommand="INSERT INTO [Clas_Course] ([Class], [Course]) VALUES (@Class, @Course)"
                            SelectCommand="SELECT [ID], [Class], [Course] FROM [Clas_Course]"
                            UpdateCommand="UPDATE [Clas_Course] SET [Class] = @Class, [Course] = @Course WHERE [ID] = @ID">
                                <asp:Parameter Name="ID" Type="Int32" />
                                <asp:Parameter Name="Class" Type="String" />
                                <asp:Parameter Name="Course" Type="String" />
                                <asp:Parameter Name="Class" Type="String" />
                                <asp:Parameter Name="Course" Type="String" />
                                <asp:Parameter Name="ID" Type="Int32" />
                     </table>   <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <div class="cornerDiv">
                <img src="Images/bLeft_corner.gif" class="float"/>
                <div class="bg_div"></div>
                <img src="Images/bRight_corner.gif" class="float"/>
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Nov 2011 Link to this post

    Hello Brk,

    In order to implement automatic datasource operations, make sure that you have set AllowAutomaticDeletes as true. Also check the following demo which implements the same.
    Grid / Automatic Operations

  3. DevCraft R3 2016 release webinar banner
Back to Top