AjaxManager within a user control

4 posts, 0 answers
  1. chani diakidis
    chani diakidis avatar
    5 posts
    Member since:
    Jan 2006

    Posted 27 Jan 2010 Link to this post

    hi,
    i'm trying to use an AjaxManager within  a User control's script using your recommended following code:
    var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID
    %>");
    ajaxManager.AjaxRequest(args);
    but everytime the page give me a 'System.NullReferenceException: Object reference not set to an instance of an object' error.
    any advice of what could be the reason?
    regards
  2. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 28 Jan 2010 Link to this post

    Hi Chani,

    Please refer to the following articles for more information about how to reference the ajax manager in master/content page scenario and trigger ajax requests from the client:
    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Ajax/Examples/Manager/MasterPage/DefaultCS.aspx
    http://www.telerik.com/help/aspnet-ajax/ajxmasterpageupdateeverywhere.html

    I hope this helps.

    Regards,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. chani diakidis
    chani diakidis avatar
    5 posts
    Member since:
    Jan 2006

    Posted 28 Jan 2010 Link to this post

    Hi Pavlina and thanks,
    Sorry but the first link was a dead link.
    In the second example (showed by the second page) the code gets the manager by calling ‘Master.FindControl’  and passing its ID which exactly what I am trying to avoid (hard coding the ID will couple my user control). Either way it is not addressing my issue here because what I’m trying to do is triggering the manager’s ‘ajaxRequest’ from the client side within my control and according to your samples through all your resources (the documentation, forum, demo site and knowledge base) your are suggesting getting the manager through the shared ‘GetCurrent(Page)’ method but using this was always getting me ‘NullReferenceException’ error no matter where I used it (client or server side)
    regards

  4. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 29 Jan 2010 Link to this post

    Hello Chani,

    The proper link is here:
    http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/usercontrol/defaultcs.aspx

    However, does using the following syntax, makes a difference?
    C#
    radMgr = $find("<%= RadAjaxManager.GetCurrent(this).ClientID %>"); 


    Sincerely yours,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top