How to delete a row from DevExpress Grid
I bind my DevExpress XtraGrid to a SQL Server database. I use the default navigator to del开发者_如何学Cete rows. I would like the database to reflect these deletions as well. How do I do this?
Erik
You should enable the ASPxGridView GridViewCommandColumn.
Here's an example using the Object Datasource but the concept is the same for any type.
<dxwgv:GridViewCommandColumn ShowSelectCheckbox="False" VisibleIndex="0" Caption="Projects">
<DeleteButton Visible="True">
</DeleteButton>
<ClearFilterButton Visible="True"></ClearFilterButton>
</dxwgv:GridViewCommandColumn>
And have the aproppiate Datasource:
<asp:ObjectDataSource ID="MyDS" runat="server"
DeleteMethod="Delete"
TypeName="Model.DataRepository">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int64" />
</DeleteParameters>
</asp:ObjectDataSource>
精彩评论