Can the OnAjaxRequest property of the RadAjaxManager be set programmatically?

4 posts, 0 answers
  1. Dana Cobb
    Dana Cobb avatar
    46 posts
    Member since:
    Mar 2007

    Posted 09 Nov 2012 Link to this post

    It says in the documentation that you can only have 1 RadAjaxManager on a page... I am thinking that I could really use the RadAjaxManager to be multi-purpose! I am currently triggering the ajaxrequest from closing a spawned radwindow) see code below...
    //OnClientClose function
    function runthisOnWindowClose() {
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();

    I was thinking that if I wanted to refresh my parent page from a second spawned radwindow ( on it's onclose event)....I would need to call a different code-behind function from the same RadAjaxManager's onajaxrequest property. So wouldn't it be nice if I could dynamically set the onajaxrequest from the codebehind when using a different popup.


  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 10 Nov 2012 Link to this post


    Please try with below code snippet.

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function myContentClickHandler() {
                $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("content");

    Jayesh Goyani
  3. DevCraft R3 2016 release webinar banner
  4. Dana Cobb
    Dana Cobb avatar
    46 posts
    Member since:
    Mar 2007

    Posted 12 Nov 2012 Link to this post

    Thanks for getting back to me Jayesh,
        Just to be sure I understand, because although I have worked with some of the controls for years, I have never pushed the envelope for ajax. Would your example be basically the same as this section of the manual?
    It seems to be relevant, but I just wanted to be sure. Regarding "eventargs"... these are probably a basic concept, but I have never really used them either. Is there a tutorial online that you feel would represent a good understanding of eventargs? I was able to successfully pass a string through recently 'RadGrid1', which allowed me to then do an if/then statement in the Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As AjaxRequestEventArgs)
    procedure, but I feel like I am only scraatching the surface and would like to make sure I have a thorough understanding.

    Regarding the initial topic of this post....could the ajaxrequest be made multi-purpose by programmatically setting the



     property to the name of a 'second' event handler in the code-behind like...

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  OnAjaxRequest="ADifferentAjaxEventHandler">
    Protected Sub ADifferentAjaxEventHandler(sender As Object, e As AjaxRequestEventArgs)
            'Do something completely different in this handler then the normal "RadAjaxManager1_AjaxRequest"
    End Sub

    so that after a postback you could prepare the page to run a completely different function? and even switch back to the original on a nother postback?

    Thanks in advance,






  5. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 15 Nov 2012 Link to this post

    Hi Dana,

    More about the ajaxRequest(eventArgs) client function could be found here:

    As for the different AjaxEventHandlers note that the required functionality could not be achieved. You could simply attach one event handler and conditionally based on the ajaxRequest arguments execute different server logic.

    Kind regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top