NullReferenceException was threw out when adding AddAjaxSetting in Content Page

2 posts, 0 answers
  1. TravelMan
    TravelMan avatar
    4 posts
    Member since:
    Feb 2009

    Posted 22 Feb 2010 Link to this post

    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>

     

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 23 Feb 2010 Link to this post

    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.
Back to Top