【发布时间】:2016-01-29 07:49:03
【问题描述】:
我在 aspx 页面中有一个 usercontrol.ascx。在我的用户控件中,我有一个按钮单击事件,我需要通过此按钮单击打开另一个用户控件。请给我一些关于如何实现这一目标的建议。
谢谢。
【问题讨论】:
-
请分享您的代码,以便我们为您提供帮助。
标签: c# asp.net user-controls response.redirect server.transfer
我在 aspx 页面中有一个 usercontrol.ascx。在我的用户控件中,我有一个按钮单击事件,我需要通过此按钮单击打开另一个用户控件。请给我一些关于如何实现这一目标的建议。
谢谢。
【问题讨论】:
标签: c# asp.net user-controls response.redirect server.transfer
您可以使用 Visible 属性。让我们用按钮 ucControl1 和另一个 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;
}
【讨论】: