Hello,
I have a content page that in turn has 'nested' master pages. Please see the following:
MasterPage1
-- MasterPage2
-- MasterPage3
-- ContentPage
I have put RadAjaxManager (RadAjaxManagerOnMasterPage1) on MasterPage1 and a RadAjaxManagerProxy on ContentPage.
MasterPage1 has a label (LabelOnMasterPage1) that I need to update when user clicks a button (ButtonOnContentPage) lying on ContentPage.
Now, on ContentPage, I have the following code.
MasterPage1 masterPage1
= (MasterPage1)this.Master.Master.Master;
RadAjaxManager radAjaxManagerOnMasterPage1
= (RadAjaxManager)masterPage1.FindControl("RadAjaxManagerOnMasterPage1");
if (radAjaxManagerOnMasterPage1 != null)
{
radAjaxManagerOnMasterPage1 .AjaxSettings.Clear();
radAjaxManagerOnMasterPage1 .AjaxSettings.AddAjaxSetting(ButtonOnContentPage, masterPage1.GetLabelOnMasterPage1);
}
NOTE: There is a property in MasterPage1 (GetLabelOnMasterPage1) that returns reference to LabelOnMasterPage1.
When I execute the above code, NullReferenceException is raised when AddAjaxSetting is called. Upon analysis, I found that RadAjaxManager.GetCurrent(ButtonOnContentPage.Page) returns NULL.
NOTE: GetCurrent() is eventually called in AddAjaxSetting (as per the disassembler code).
I tried writing this code both at Page_Load and OnPreRender but it worked nowhere.
Kindly tell me what is it that I am missing?
~Abhay
I have a content page that in turn has 'nested' master pages. Please see the following:
MasterPage1
-- MasterPage2
-- MasterPage3
-- ContentPage
I have put RadAjaxManager (RadAjaxManagerOnMasterPage1) on MasterPage1 and a RadAjaxManagerProxy on ContentPage.
MasterPage1 has a label (LabelOnMasterPage1) that I need to update when user clicks a button (ButtonOnContentPage) lying on ContentPage.
Now, on ContentPage, I have the following code.
MasterPage1 masterPage1
= (MasterPage1)this.Master.Master.Master;
RadAjaxManager radAjaxManagerOnMasterPage1
= (RadAjaxManager)masterPage1.FindControl("RadAjaxManagerOnMasterPage1");
if (radAjaxManagerOnMasterPage1 != null)
{
radAjaxManagerOnMasterPage1 .AjaxSettings.Clear();
radAjaxManagerOnMasterPage1 .AjaxSettings.AddAjaxSetting(ButtonOnContentPage, masterPage1.GetLabelOnMasterPage1);
}
NOTE: There is a property in MasterPage1 (GetLabelOnMasterPage1) that returns reference to LabelOnMasterPage1.
When I execute the above code, NullReferenceException is raised when AddAjaxSetting is called. Upon analysis, I found that RadAjaxManager.GetCurrent(ButtonOnContentPage.Page) returns NULL.
NOTE: GetCurrent() is eventually called in AddAjaxSetting (as per the disassembler code).
I tried writing this code both at Page_Load and OnPreRender but it worked nowhere.
Kindly tell me what is it that I am missing?
~Abhay