只有10分,问 动态加载用户控件取 属性值问题
我要在页面中动态加载一些用户控件,每个用户控件都是一个独立的逻辑单元,我给他们每一个都增加属性便于对外访问,
比如:
public partial class WebUserControl1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
this.strSql = this.textbox1.text + this.text2.text + ... ;
}
/// <summary>
/// 公共成员
/// </summary>
public string strSql;
}
把他们加载在页面的placeholder中,
protected void Page_Load(object sender, EventArgs e)
{
if(!this.ispostback)
{
this.LoadControl("WebUserControl1.ascx")
this.LoadControl("WebUserControl2.ascx")
this.LoadControl("WebUserControl3.ascx")
}
else
{
//怎样在页面回发的时候取得控件的公共成员的值呢,this.placeholder.controls.count = 0
}
}
怎么取呢
比如:
public partial class WebUserControl1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
this.strSql = this.textbox1.text + this.text2.text + ... ;
}
/// <summary>
/// 公共成员
/// </summary>
public string strSql;
}
把他们加载在页面的placeholder中,
protected void Page_Load(object sender, EventArgs e)
{
if(!this.ispostback)
{
this.LoadControl("WebUserControl1.ascx")
this.LoadControl("WebUserControl2.ascx")
this.LoadControl("WebUserControl3.ascx")
}
else
{
//怎样在页面回发的时候取得控件的公共成员的值呢,this.placeholder.controls.count = 0
}
}
怎么取呢
...全文
相关推荐
qt中QVBoxLayout,QHBoxLayout布局中实现控件的动态加载与显示
这是一个qt的小项目,主要是为了展示如何在QVBoxLayout或者QHBoxLayout布局下动态的进行控件的加载与展示
.net动态加载用户控件
一个不错的动态加载用户控件的例子.附有源代码和说明文档
详解如何实现Element树形控件Tree在懒加载模式下的动态更新
主要介绍了详解如何实现Element树形控件Tree在懒加载模式下的动态更新,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
动态加载带参数的ASCX用户控件
通过JQUERY或页面后台处理程序加载带参数的ASCX用户控件
动态加载用户控件至DataList并为用户控件赋值实例演示
本文借用使用通用的新闻例子演示动态加载用户控件至DataList并为用户控件赋值,感兴趣的朋友可以了解下


