子控件A中
ControlB _bbb;
public ControlB bbb
{
get { return _bbb; }
set { _bbb= value; }
}
protected void btnClear_Click(object sender, EventArgs e)
{
if (null != bbb)
{
bbb.Visible = false;
}
}
protected void btnShow_Click(object sender, EventArgs e)
{
if (null != bbb)
{
bbb.Visible = true;
}
}
母体中
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
........
}
ControlA_ID.ControlB_ID=ControlB_ID;
}
本文介绍了一个简单的控件可见性管理方法,在子控件A中定义了ControlB,并通过两个按钮实现了显示和隐藏ControlB的功能。此外,在母体中加载页面时会进行相应的初始化设置。
36

被折叠的 条评论
为什么被折叠?



