Search code examples
c#asp.netgridviewwebformssqldatasource

Hiding a specific table in .net webforms when button is clicked


I have two tables connected to different sqldatasources, but I would like only one of them to be displayed when a certain button is clicked.

I tried hiding the tables using a Jquery plugin, but this hides both tables.

I am expecting the first table to be hidden, and the second one to be displayed when a button is clicked.


Solution

  • If you are using panels you can use .visible

    protected void Button1_Click(object sender, EventArgs e)
            {
                Panel1.Visible = true;
                Panel2.Visible = false;
            }