How to delete row in gridview using rowdeleting event?

前端 未结 16 1563

This is my .cs code :

protected void Gridview1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
 Gridview1.DeleteRow(e.RowIndex);
 Gridvi         


        
16条回答
  •  不思量自难忘°
    2020-12-03 16:53

    In Grid use this code having ID as your Primary Element so to uniquely identify each ROW

    
                
                
                
    
    

    and to search the uique ID use the code in C# code behind (basically this is searching hidden field and storing it in a var)

    protected void Grd_Registration_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            var ID = (HiddenField)Grd_Registration.Rows[e.RowIndex].FindControl("ID");
            //Your Delete Logic Goes here having ID to delete
    
            GridBind();
    
        }
    

提交回复
热议问题