Deleting a row in datagrid view

前端 未结 5 706
情歌与酒
情歌与酒 2021-01-26 06:33

I want to Delete a row in the Gridview which is in the update panel . But instead of the command button ., i took a link button to get a confirmation message. Now if I press ok

5条回答
  •  借酒劲吻你
    2021-01-26 07:25

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            String productId = row.Cells[0].Text; // I suposed your product Id in very first column in gridview
            //Delete Code goes here..........
            ...........................
        }
    }
    

提交回复
热议问题