I recommend handling this during the RowDatabound event. To do this you will want to add this to the gridview.
onrowdatabound="GridView1_RowDataBound"
Then you will need to create the event handler in the code.
protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1");
if (e.Row.Cells[1].Text != "5")
{
ddl.Visible = false;
}
}
}You will want to find which Cell contains the number you're looking for. There are obviously other solutions, but I like this one.
I hope that works out for you,
Brendan
C. Brendan Enrick
Brendan's ASP.NET Advice BlogMake sure you click "Mark as Answer" for any post which has helped you. This will give recognition to those helping others as well as earn you a point. It also helps people know which posts still need work.