Help me understand ajaxRequest and ajaxRequestWithTarget

4 posts, 0 answers
  1. Chris McGrath
    Chris McGrath avatar
    23 posts
    Member since:
    Dec 2009

    Posted 23 Jul 2010 Link to this post


    I have a page that I had working with RadAjaxPanels, but I'm trying to re-wire it using RadAjaxManager for the sake of learning how to use that tool properly.

    My page has a grid on it that refreshes itself when its command buttons are clicked.  The page also has a popup window, and when the user updates information on the popup window, it calls a refresh() javascript function on my main page, which calls the ajaxRequest function of the RadAjaxPanel, which updates the grid.  This all works great.

    Now that I'm trying to re-wire it with a RadAjaxManager, I'm trying to reproduce this functionality.  Unfortunately, the refresh() javascript function that I have now changed to call the RadAjaxManager1.ajaxRequest() function does nothing.  The AjaxRequest code never gets called.

    Then I thought maybe if I called ajaxRequestWithTarget and used the grid object as my target, that would produce the correct results.  Unfortunately while I can see that the event is firing because the grid shows the loading panel for a moment, the data is not refreshing.  After looking through all the documentation and examples, I'm confused.  I can't figure out what C# event fires when doing an ajaxRequestWithTarget event.  Nothing in your examples specifies the event to be called.  What grid event gets fired when I use it as the target?

  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 29 Jul 2010 Link to this post

    Hello Chris,

    Please note that ajaxRequestWithTarget is designed as a substitute of the standard __doPostBack function. Thus, you need to override RaisePostBackEvent of the page in order to get its argument server-side.When you set a control as eventTarget it will raise an AJAX request and will update the controls that it was set to update in the property editor. This function can be handled by the correspondent event handler (i.e. Button_Click) on the server.

    Kind regards,
    Maria Ilieva
    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
  3. Batoha
    Batoha avatar
    22 posts
    Member since:
    Jun 2010

    Posted 24 Aug 2010 Link to this post

    Hello, Maria.
    The subject is still unclear. Could you please provide some examples and explanations?

    With respect, Sergey.
  4. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 24 Aug 2010 Link to this post

    I think what Maria is trying to explain is that if you had an AjaxSetting where, for example, a button was setup as the ajax initiator. You could use ajaxRequestWithTarget to raise that AjaxSetting by passing the button as the target and get it to raise it's Click event. Thus, causing the controls it updates in the UpdatedControls collection to be updated.

    So pretty much it allows you to raise an ajax request by using one of your existing AjaxSettings, without having the user to raise one that control's events.
Back to Top