Click here to Skip to main content
14,665,013 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to delete Specific row on condition
     protected void ItemDataBound(object sender, GridViewRowEventArgs e)
{
  if (Childs < 5)
 {
                     
                       
grdname.Parent.Controls.RemoveAt(e.Row.RowIndex);

 }
}
Posted
Comments
solanki.net 12-Mar-13 4:34am
   
can u explain on which event u want to delete row ?

Rate this:
Please Sign up or sign in to vote.

Solution 1

Try Gridview RowCommand method for deleting a row
void gridView_RowCommand(Object sender, GridViewCommandEventArgs e)
{
if(e.CommandName=="Remove")
{
     var childs= Int32.Parse(e.CommandArgument);
if(childs<5)
     gridView.DeleteRow(id);

 }
}


Go through this link more about RowCommand Event
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx[^]
Hope this helps
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

e.row.visible=false;
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100