我試圖訪問一個ModalPopupExtender控件,並且它總是返回null或對象集未設置爲對象的實例。我試過master.Page.FindControl(「」)和master.FindControl(「」)和IM仍然沒有得到結果在MasterPage上查找控件返回nulll
MasterPage master = Page.Master as MasterPage;
AjaxControlToolkit.ModalPopupExtender popup = master.Page.FindControl("ModalPopupExtender2") as AjaxControlToolkit.ModalPopupExtender;
更新時間:不能改變我的標籤的文字母版頁
MasterPage master = Page.Master;
AjaxControlToolkit.ModalPopupExtender popup1 = master.FindControl("ModalPopupExtender1") as AjaxControlToolkit.ModalPopupExtender;
Label lblMessage = master.FindControl("lblMessage") as Label;
lblMessage.Text = msg;
Literal ltrlMessage = master.FindControl("ltrlMessage") as Literal;
ltrlMessage.Text = msg;
Label MessageStatus = master.FindControl("lblMessageStatus") as Label;
MessageStatus.Text = msgStatus;
popup1.Show();
控制是不公開的 – 2012-02-23 23:46:02
我已經更新了我的代碼,我可以訪問PopupExtender,但我無法更改標籤文本屬性,你知道如何將文本更改爲我的消息 – ONYX 2012-02-24 01:05:12