BoundField
Something like below would work, if you have used
BoundField
.
private void GridImport_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[2].Text.Equals("D"))
e.Row.Visible = false;
}
}
TemplateField
If the value is inside a
TemplateField
, then you need to find that control and then try to compare the text like... Suppose there is a
TextBox
inside
TemplateField
, where the value is fastened.
private void GridImport_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TextBox txtStatus = (TextBox)rw.FindControl("txStatus");
if (txtStatus.Text.Equals("D"))
e.Row.Visible = false;
}