This is a migrated thread and some comments may be shown as answers.

NullReferenceException was threw out when adding AddAjaxSetting in Content Page

1 Answer 60 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
TravelMan
Top achievements
Rank 1
TravelMan asked on 22 Feb 2010, 06:23 PM
Hey,

I put RadAjaxManager and RadAjaxLoadingPanel in Master page and try to call AddAjaxSetting in content page. The NullReferenceException thew out.

here is code in content page

 

protected void Page_Load(object sender, EventArgs e)

 

{


Button
searchButton = (Button)this.SearchCriteria.FindControl("btnSearch");

 

 

RadAjaxManager AjaxManager = (RadAjaxManager)this.Master.FindControl("RadAjaxManager1");

 

AjaxManager.AjaxSettings.AddAjaxSetting(searchButton,

this.radGrid, null);

 

 

if (!IsPostBack)

 

{

// BuildGrid();

}

}

Here is code in master page

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">

 

 

 

 

 

</telerik:RadAjaxManager>

 

 

 

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"

 

 

 

 

 

Width="75px">

 

 

 

 

 

<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'

 

 

 

 

 

style="border: 0px;" />

 

 

 

 

 

</telerik:RadAjaxLoadingPanel>

 

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 23 Feb 2010, 03:47 PM
Hi Lei,

Please try using the RadAjaxManager.GetCurrent() static method to get reference to the RadAjaxManager placed in the master page and see if it makes any difference:

protected void Page_Load(object sender, EventArgs e) 
{
    RadAjaxManager AjaxManager = RadAjaxManager.GetCurrent(Page);
}

Additionally, you can check the below articles for more information on how to use RadAjax in master/content page scenarios:
http://www.telerik.com/help/aspnet-ajax/ajxajaxmasterpage.html
http://www.telerik.com/help/aspnet-ajax/ajax-manager-proxy.html
http://www.telerik.com/help/aspnet-ajax/ajxmasterpageupdateeverywhere.html
http://www.telerik.com/help/aspnet-ajax/ajxloadcontrolfromanotherwebusercontrolindifferentmasterpagecontentplaceholder.html

Greetings,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Ajax
Asked by
TravelMan
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or