redirection from one user control to another user control

1k Views Asked by At

I have a usercontrol.ascx in a aspx page. And in my user control I have a button click event, and I need to open another user control from this button click. Please give me some suggestions on how to achieve this.

Thanks.

1

There are 1 best solutions below

0
On

You can use Visible property. Let's call the user control with the button ucControl1 and the other ucControl2.

// code-behind of ucControl1
protected void Page_Load(object sender, EventArgs e)
{
  if(!IsPostBack)
    ucControl2.Visible = false;
}

protected void btn_Click(object sender, EventArgs e)
{
    ucControl2.Visible = true;
}