This is a migrated thread and some comments may be shown as answers.

OnAjaxRequest cannot fire on IE and FireFox But working on Chrome

1 Answer 18 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Myo
Top achievements
Rank 1
Myo asked on 30 Jun 2014, 08:42 AM
Can any body help me why does IE and FireFox cann't fire OnAjaxRequest. But Chrome can work properly . I want to publish my code

ASPX

  <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                    <asp:ScriptReference Path="~/JavaScripts/lib/jquery-ui-1.10.4.min.js" />
                    <asp:ScriptReference Path="~/JavaScripts/lib/jquery.blockUI.min.js" />
                    <asp:ScriptReference Path="~/JavaScripts/lib/Json2.min.js" />
                </Scripts>
                <Services>
                    <asp:ServiceReference Path="~/Services/ReservationService.asmx" />
                </Services>
            </telerik:RadScriptManager>
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadAjaxManager1"/>
                            <telerik:AjaxUpdatedControl ControlID="grdBillingContact" />
                            <telerik:AjaxUpdatedControl ControlID="hdnChkEmptyRow" />
                            <telerik:AjaxUpdatedControl ControlID="grdTrans" />
                            <telerik:AjaxUpdatedControl ControlID="grdLedger1" />
                            <telerik:AjaxUpdatedControl ControlID="grdLedger2" />
                            <telerik:AjaxUpdatedControl ControlID="grdLedger3" />
                            <telerik:AjaxUpdatedControl ControlID="grdLedger4" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="grdBillingContact">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="grdBillingContact" />
                            <telerik:AjaxUpdatedControl ControlID="hdnChkEmptyRow" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>

                    <telerik:AjaxSetting AjaxControlID="grdTrans">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="grdTrans" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="grdBillingContact" />
                            <telerik:AjaxUpdatedControl ControlID="hdnChkEmptyRow" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
                <ClientEvents OnRequestStart ="RequestStart" OnResponseEnd="ResponseEnd" />
            </telerik:RadAjaxManager>


  function onRowDropping(sender, args) {
                    var draggedItems = args.get_draggedItems();
                    var rateKey = null;
                    if (draggedItems.length === 1) {
                        rateKey = draggedItems[0].getDataKeyValue('ReservationRateKey');
                    }
                    var destinationHtmlElement = args.get_destinationHtmlElement();
                    var sender_id = sender.get_id();
                    switch (sender_id) {
                        case 'grdLedger1': {
                            if (isChildOf('<%=grdLedger2.ClientID %>', destinationHtmlElement)) {
                                if (rateKey !== null) {
                                    var cmd = 'UpdateLedger|' + rateKey + '|2';
                                    AjaxRequest(cmd);
                                }
                            }
                            else if (isChildOf('<%=grdLedger3.ClientID %>', destinationHtmlElement)) {
                                    if (rateKey !== null) {
                                        var cmd = 'UpdateLedger|' + rateKey + '|3';
                                        AjaxRequest(cmd);
                                    }
                                }
                                else if (isChildOf('<%=grdLedger4.ClientID %>', destinationHtmlElement)) {
                                    if (rateKey !== null) {
                                        var cmd = 'UpdateLedger|' + rateKey + '|4';
                                        AjaxRequest(cmd);
                                    }
                                }
                                else {
                                    args.set_cancel(true);
                                }
                        }
break;
}
}
 function isChildOf(parentId, element) {
                    while (element) {
                        if (element.id && element.id.indexOf(parentId) > -1) {
                            return true;
                        }
                        element = element.parentNode;
                    }
                    return false;
                }


 function AjaxRequest(command) {
                     var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
                    ajaxManager.ajaxRequest(command);
                }

.CS


 protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
       // base.RaisePostBackEvent(source, eventArgument);
        string eventArgument = e.Argument;
        if (eventArgument != null)
        {
             if (eventArgument.StartsWith("UpdateLedger|")) 
            {
                string[] strs = eventArgument.Split('|');
                if(strs.Length == 3)
                {
                    Guid? rateKey = Others.GetGuid(strs[1]);
                    int? ledger = Others.GetIntFromString(strs[2]);
                    if (rateKey.HasValue && ledger.HasValue)
                    {
                        bool updated = HMSModel.BLL.ReservationRateDB.UpdateReservationRateLedger(rateKey.Value, ledger.Value, ConnectionManager.CreateConnection(true));
                        if(updated)
                        {
                            this.LoadAllData(); // Reload all the data before rebind
                            BindLedgerList();
                        }
                    }
                }
            }
        }
    }

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 02 Jul 2014, 02:46 PM
Hi Myo,

Based on he provided description it is rather difficult to determine what exactly is causing the problematic  behavior only in specific browsers.
I suppose that the main reason for the issue is a JS error that appear before executing the client ajaxRequest which is leading to the problem you are facing.
Could you please inspect the server request using the browser console and verify if any JS errors appear?




Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Ajax
Asked by
Myo
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or