UserControl的问题 写了个usercontrol页里,包括一个checkbox控件, id=checkbox1在页面A加载这个usercontrol,想显示这个checkbox在页面B加载这个usercontrol,想隐藏这个checkbox请问如何做?谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在usercontrol后台添加一公用方法 public void setVisible(bool show) { this.CheckBox1.Visible = show; }A页面里 protected void Page_Load(object sender, EventArgs e) { this.WebUserControl1.setVisible(true); }B页面里 protected void Page_Load(object sender, EventArgs e) { this.WebUserControl1.setVisible(false); } LS应该可行,不过我认为设置CSS的Display属性更好。 UserControl里面:public partial class WebUserControl : System.Web.UI.UserControl{ private Boolean _IsVisable; public Boolean IsVisable { get { return _IsVisable; } set { _IsVisable = value; } } protected void Page_Load(object sender, EventArgs e) { this.Button1.Visible = _IsVisable; }}页面A或者页面B里面:public partial class Default11 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { this.WebUserControl1.IsVisable = true; }} public CheckBox MyCheckBox{get{return this.MycheckBox;}}然后在page上就可以操作这个checkboc 了 怎么用C#实现在同一坐标下同时显示柱形图和折线图 (利用OWC) 谁有支付宝的例子? 球一句SQL查询 Jquery ASP.NET用框架集的问题,急。。。。 押宝游戏黑人的多不,哪些可以押,哪些不要押? 使用VSS的ASP.NET项目如何脱离服务器? 请孟子大哥等高手救命!!!! WEB下的DataGrid问题 一个入门级的问题,关于域名问题 asp.net打包出错误 MS vs 2005 的 web developer 在哪里?
public void setVisible(bool show)
{
this.CheckBox1.Visible = show;
}A页面里
protected void Page_Load(object sender, EventArgs e)
{
this.WebUserControl1.setVisible(true);
}B页面里
protected void Page_Load(object sender, EventArgs e)
{
this.WebUserControl1.setVisible(false);
}
UserControl里面:
public partial class WebUserControl : System.Web.UI.UserControl
{
private Boolean _IsVisable;
public Boolean IsVisable
{
get
{
return _IsVisable;
}
set
{
_IsVisable = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.Button1.Visible = _IsVisable;
}
}页面A或者页面B里面:
public partial class Default11 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.WebUserControl1.IsVisable = true;
}
}
{
get
{
return this.MycheckBox;
}
}然后在page上就可以操作这个checkboc 了