Web Grid Delete

Posted by: wilcousa on 10 September 2017, 11:35 am EST

  • Posted 10 September 2017, 11:35 am EST

    I have added a column from the grid manager to allow for deleting a record in the grid(Command Field). However, when Delete is clicked(Link), all the records disappear. How can I stop this from happening?


    Thanks,

  • Replied 10 September 2017, 11:35 am EST

    Could you please provide a sample illustrating the issue?


    Below is a snippet illustrating how to implement row deletion in C1GridView.


     


     


        <C1GridView:C1GridView ID="C1GridView1" runat="server"

            AutoGenerateColumns="False" DataKeyNames="CategoryID" DataSourceID="AccessDataSource1">

            <Columns>
                <C1GridView:C1CommandField ShowDeleteButton="true" />

                <C1GridView:C1BoundField HeaderText="CategoryName" DataField="CategoryName" />

                <C1GridView:C1BoundField HeaderText="Description" DataField="Description" />

            </Columns>
        </C1GridView:C1GridView>

            
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="WebGridDemo.mdb" 

            SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]"
            DeleteCommand="DELETE FROM [Categories] WHERE [CategoryID] = ?">

            <DeleteParameters>
                <asp:Parameter Name="CategoryID" Type="Int32" />

            </DeleteParameters>
        </asp:AccessDataSource></pre>

     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels