有index.aspx
  a.ascx
  a1.ascx
  a2.ascxindex.aspx加载a.ascx
|a.ascx判断,在加载a1.ascx或a2.ascx
|然后,a1.ascx或a2.ascx显示在index.aspx页中该怎么写asp.net c#????????

解决方案 »

  1.   

    在用户控件里有某些属性,在index.aspx判断一下是否有这些属性,则加载成功了,
      

  2.   

    各位能不能写仔细点?
    tks!!
      

  3.   

    a.ascx
    可以定义个属性比如
    private string _dwdm = "";
    public string Dwdm
            {
                get
                {
                    return this._dwdm;
                }
                set
                {
                    this._dwdm = value;
                }
            }index.aspx加载a.ascx在后台写属性值,比如a.ascx控件名为dw_head
    this.dw_head.Dwdm = "XXX";你把a1.ascx或a2.ascx
    代码弄到a.ascx即可,没必要弄a1.ascx和a2.ascx,根据参数控制对象的是否显示.
    if (this._dwdm  == "XXX")
                            {
                                this.divFlash.Visible = false;
                                this.divPic.Visible = true;
                            }