如何将用户控件从另一个用户控件添加到default.aspx页 [英] how to add usercontrol to default.aspx page from another usercontrol
本文介绍了如何将用户控件从另一个用户控件添加到default.aspx页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Default.aspx页面中有UserControl1,其中有一个Panel1
UserControl1具有button1
而且我的网站中有UserControl2
我想要在UserControl1中按button1时,将UserControl2动态添加到
Default.aspx页面中的Panel1
I have UserControl1 in Default.aspx page which have a Panel1
UserControl1 has button1
and I have In my WebSite UserControl2
I want when I Press on button1 in UserControl1 , Dynamically add UserControl2 to
Panel1 in Default.aspx page
推荐答案
在用户控件1中向控件2添加引用.设置那个control2.Visible = false;.单击按钮时,设置control2.Visible = true;
In user control 1 add reference to control 2. Set that control2.Visible = false;. When button is clicked set control2.Visible = true;
这篇关于如何将用户控件从另一个用户控件添加到default.aspx页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文