title: Disable a control inside a gridview
body: <p>Hi i want to disable link-bottoms control in a grid view with the condition of a special  value . for example if the count for a row become 0 ,the link bottom for that row should be invisible . what should i do? where should i write the code?
  here is cod that i write in row command grid view but it works only of i push the link bottom!! but i want to apply this cod to my page before loading.
  please guide me</p>
  
  <pre><code>    int idx = Convert.ToInt32(e.CommandArgument);
  
      idx = idx - (GridView1.PageSize * GridView1.PageIndex);
  
      int ID = (int)GridView1.DataKeys[idx].Value;
      string connStr = ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString;
      SqlConnection sqlconn = new SqlConnection(connStr);
      SqlCommand sqlcmd = new SqlCommand();
      sqlcmd = new SqlCommand("SELECT count(ID) FROM ReviwerArticle where ArticleID=@ArticleID", sqlconn);
      sqlcmd.Parameters.AddWithValue("@ArticleID", ID);
  
      sqlconn.Open();
      int count = ((int)sqlcmd.ExecuteScalar());
  
      sqlconn.Close();
      if (count == 0)
      {
                  ((LinkButton)GridView1.Rows[idx].Cells[0].FindControl("LinkButton4") as LinkButton).Visible = false;
  
      }
  </code></pre>