The GridView 'PendingRecordsGridview' fired event RowDeleting which wasn't handled

后端 未结 2 1334
清酒与你
清酒与你 2020-12-17 21:16

I\'ve searched in google there\'s an easy way to delete a record with confirmation using this code:


                  


        
相关标签:
2条回答
  • 2020-12-17 21:53

    Please modify your markup and code to include the OnRowDeleting event.

    <asp:GridView OnPageIndexChanging="PendingRecordsGridview_PageIndexChanging" ID="PendingRecordsGridview" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" OnRowcommand="PendingRecordsGridview_RowCommand" DataSourceID="sd1" BorderStyle="Ridge" BackColor="White" BorderColor="Black" BorderWidth="3px" CellPadding="4" Width="1070px" PageSize="2" AllowPaging="True">
            <RowStyle ForeColor="#003399" HorizontalAlign="Center" OnRowDeleting="PendingRecordsGridview_RowDeleting"/>
    

    On the code behind add this method.

    public void PendingRecordsGridview_RowDeleting (Object sender, GridViewDeleteEventArgs e)
    {
    
    } 
    
    0 讨论(0)
  • 2020-12-17 22:02

    You are trying with a command name of Delete for your delete button. So the gridview creates a row deleting event automatically....

    You need to change the command argument from Delete to something else like Delete_Product or whatever...

    0 讨论(0)
提交回复
热议问题