ashwini patel

ashwini patel

  • NA
  • 143
  • 9.5k

How to select values from gridview and give in textbox

Sep 4 2018 1:33 AM
I need to check whether the cells of a particular column in gridview has certain values. If the cells contain values it should do some action. I have attached my code.
 
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (TextBox1.Text != "")
{
if ((e.Row.Cells[3].Text == "1") && (e.Row.Cells[3].Text == "2"))
{
Label3.Visible = true;
}
}
}
}
 
It is not checking the AND condition. If i replace it by OR statement it works

Answers (7)