Hello, with help i was able to do a show hide gridview button, but the problem is it only works once, when i press the show button again the gridview is not shown. This is my code:
protected void Button3_Click(object sender, EventArgs e)
{
if (HideShowButton.Text == "Hide")
{
HideShowButton.Text = "Show";
GridView1.Visible = false;
}
else if (HideShowButton.Text == "Show")
{
HideShowButton.Text = "Hide";
bindgrid();
}
}
public void bindgrid()
{
con = new SqlConnection(connString);
da = new SqlDataAdapter("select * from Table_1", con);
ds = new DataSet();
da.Fill(ds, "Table_1");
GridView1.DataSource = ds.Tables["Table_1"];
GridView1.DataBind();
}
...
Go to the complete details ...