RadAjaxManager1_AjaxRequest Not Firing

3 posts, 0 answers
  1. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 22 Dec 2009 Link to this post

    I have RadListBox1 and RadListBox2.  They are parked in a RadPageView attached to a RadTab.  Either listbox can transfer (move) items from one to the other with the transfer button, 2x-click, or drag-n-drop.  Everything is cool.  I have a "Save" button, the purpose of which is to update RadListBox2's database table.  On button_click I am grabbing the items in RadListBox2 as a collection, parsing the collection, and transforming into a comma-delimited string all on the client in order to pass through RadAjaxManager1_AjaxRequest:

    function btnClick() {  
        var list = $find("<%= radListBox2.ClientID %>");  
        var lstNames = list.get_items();  
        var arg;  
        if( lstNames.get_count() == 0 ) {  
            if (confirm("blah, blah, blah.\n\nProceed?")) {  
                arg = 0;  
            } else { return 0; }  
        } else {  
            arg = lstNames.get_count() + ",";  
            lstNames.forEach( function( item ) { arg = arg + item.get_text() + ","; });  
            arg = arg.substr( 0, arg.length - 1 );  
        var ajaxMgr = $find("<%= RadAjaxManager1.ClientID %>");  
        ajaxMgr.ajaxRequest( arg );  

    I have confirmed through JavaScript alerts that all is well here.  BUT - ajaxMgr.ajaxRequest( arg ) doesn't fire its associated method in the code-behind.  RadScriptManager is set:

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"

    I have Ajax turned on in Page_Load:

    RadAjaxManager.GetCurrent( Me ).EnableAJAX = True 

    I have AutoPostBackOnTransfer turned off on both listboxes because nothing works when switched on:

    radListBox1.AutoPostBackOnTransfer = False 
    radListBox2.AutoPostBackOnTransfer = False 

    And the code-behind method looks fine to me:

    Protected Sub RadAjaxManager1_AjaxRequest( sender As Object, e As AjaxRequestEventArgs ) Handles RadAjaxManager1.AjaxRequest  
        Dim str_Array As String() = Split( e.Argument, "," )  
        Dim numRecords = Integer.Parse( str_Array( 0 ))  
        Dim lst_Tables As IList( Of String ) = New List( Of String )  
        Dim p_data As String = String.Empty   
        If numRecords > 0 And numRecords < 10 Then  
            p_data = e.Argument.Substring( 2 )  
        ElseIf numRecords > 9 And numRecords < 100 Then  
            p_data = e.Argument.Substring( 3 )  
            p_data = e.Argument.Substring( 4 )  
        End If  
        ' sanity check  
        RadAjaxManager1.Alert( "numRecords = " & numRecords )  
        RadAjaxManager1.Alert( "p_data = " & p_data)  
        * * *  
    End Sub 

    But my sanity checks are never invoked.

    Got any clues, guys?

  2. Nikolay Rusev
    Nikolay Rusev avatar
    2277 posts

    Posted 28 Dec 2009 Link to this post

    Hello Mark,

    I guess you are not handling client click event of Save button correctly.
    For your convenience I am sending sample page demonstrating that server AjaxRequest event is fired.
    Please find the attachment.

    All the best,
    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. DevCraft R3 2016 release webinar banner
  4. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 28 Dec 2009 Link to this post

    Thanks for replying, Nikolay!

    The problem is this:

        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"></telerik:AjaxSetting> 
        <telerik:AjaxSetting AjaxControlID="btn_Save">  
                <telerik:AjaxUpdatedControl ControlID="radListBox1" LoadingPanelID="RadLoadingPanel1" />\  
                <telerik:AjaxUpdatedControl ControlID="radListBox2" LoadingPanelID="RadLoadingPanel1" /> 

    Whenever I add the AjaxSettings, the listboxes stop calling AjaxRequest from the client.  When I remove AjaxSettings, AjaxRequest is called and the database is updated, though the browser must be manually refreshed to see the changes.  This has been a PITA for over a week now.

Back to Top