title: Enable and disable link button on gridview
body: <p>I wants to enable or disable linkbutton on some rows of gridview based on condition.. Can i enable linkbutton on one row and disable it on another row of same grid view ??my code is here</p>
  
  <pre><code>  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  {LinkButton lnk2 = (LinkButton)e.Row.FindControl("LinkButton2");
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
  
          SqlCommand cmd12 = new SqlCommand("Select testsession_status from student_vs_testsession_details where  testsession_id='" + v_testid.Text + "' ", con12);
          SqlDataReader dr12 = cmd12.ExecuteReader();
          while (dr12.Read())
          {
              string test_status = dr12[0].ToString();
              LinkButton lnk2 = (LinkButton)e.Row.FindControl("LinkButton2");
              foreach (GridViewRow row in GridView1.Rows)
              {
                  if (v_testtype == "Theory Test" &amp;&amp; test_status == "Completed")
                  {
                      lnk2.Visible = true;
                  }
                  else
                  {
                      lnk2.Visible = false;
                  }
  
              }
  
  
  
  
          }
  </code></pre>