亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

.NET動態(tài)加載用戶控件并傳值的方法

 更新時間:2013年04月02日 09:54:11   作者:  
.NET動態(tài)加載用戶控件并傳值的方法,有需要的朋友可以參考一下

ASPX.CS里的代碼:

復制代碼 代碼如下:

UserControl uc = (UserControl)LoadControl(actionOne[1].ToString());
uc.GetType().GetProperty("cid").SetValue(uc, cid.ToString(), null);//主要就在這里,這里是添加屬性,并賦值。
uc.GetType().GetProperty("aid").SetValue(uc, id.ToString(), null);
pageAscx.Controls.Add(uc);

以下是ASCX下面的代碼

復制代碼 代碼如下:

    public string _cid = "0";
    public string _aid = "0";

    public string cid
    {
        get
        {
            return _cid;
        }
        set
        {
            _cid = value;
        }
    }
    public string aid
    {
        get
        {
            return _aid;
        }
        set
        {
            _aid = value;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

相關文章

最新評論