Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i hide first gridview row with a command field 'Delete'. only row hide have done. but with a command field, i need an idea how can do this.........

What I have tried:

protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.Cells[1].Text == "bv")

e.Row.Cells[1].Visible = false;
}
Posted
Updated 17-Apr-16 20:37pm
v2
Comments
an0ther1 17-Apr-16 19:08pm    
You can set an entire row to be hidden using dataGridView.Rows[rowIndex].Visible = false
but I don't think this is what you want.
Please improve your question advising what you are trying to do & where you are having a problem.

Kind Regards
Shwrv 17-Apr-16 20:06pm    
i've a gridview with command field 'Delete' . now i want hide first row of this gridview with the command field 'Delete'. without command field row can hide but i need this field other rows. @an0ther1
an0ther1 18-Apr-16 19:19pm    
See next comment from priyadarshini - this is what you would normally do - delete the row from your data source & then rebind the gridview.
Is there a reason that you do not want to do this?
priyadarshini tv 18-Apr-16 0:38am    
HiHow you are binding the grid??
If you are binding the grid with datatable u can delete that particular row from datatable and u can rebind the grid inside rowcommand event.

1 solution

e.Rows[0].Visible = false;
;

e is gridview
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900