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

issue with ajax request on firefox but not on IE

11 Answers 70 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Joshua Gates
Top achievements
Rank 1
Joshua Gates asked on 21 Sep 2009, 08:41 PM
i am trying to do some ajaxRequest via  javascript and not having alot of success with other browsers except IE.
here is the code


function SendClientMessage() {
var msgtext = document.getElementById("<%= message.ClientID %>");
if (msgtext != null) {
var eventArgs = "AddClientMsg";
clientMsgAdded = true;
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(eventArgs);
}
}
function KeyDown(e) {
var keyPressed;
if (window.event) {
keyPressed = window.event.keyCode;
} else {
keyPressed = e.which;
e.preventDefault();
}
if (keyPressed == 13) // checks whether the ENTER key
// is pressed
{
window.event.cancelBubble = true;
window.event.returnValue = false;
SendClientMessage();
}
}

and then in my code behind i have this.
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
if (e.Argument.ToLower().Equals("addclientmsg"))
{
ChatMessage msg = new ChatMessage();
msg.SentAt = DateTime.Now;
msg.UserID = anonymousUser.AnonymousUserID;
msg.UserType = ChatUserEnum.ChatUserType.Client;
msg.UserName = anonymousUser.FirstName + " " + anonymousUser.LastName;
msg.Message = message.Text;
int roomID = 0;
int.TryParse(hidRoomID.Value, out roomID);
ChatClientEngine.AddMessageToRoom(msg, roomID);
message.Text = "";
}
else if (e.Argument.Equals("closeChatRoom"))
{
CloseChatRoom();
}
}
now with IE it all works fine...even the closechatroom which is 
 function closeChatRoom() {
                    try {
                        var eventArgs = "closeChatRoom";
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(eventArgs);
                    } catch (e) {
                        alert(e);
                    }
//                    var strArg = "closeChatRoom";
//                    __doPostBack('closeChatRoom', strArg);
                }

and is set on onbeforeunload="closeChatRoom();"

again with IE it all works fine...
however with Firefox it does not....i can place alert in javascript and i get the alert..but i never get anything in the code behind...except on IE

any ideas?

thanks

11 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 24 Sep 2009, 01:04 PM
Hello Joshua,

Please, refer to the support ticket post that you have opened on the same matter for additional information. To avoid duplicate posts, we can continue our communication there.

Greetings,
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.
0
Joshua Gates
Top achievements
Rank 1
answered on 05 Oct 2009, 08:22 PM
i saw the support ticket, however, this is embedded into our application. it seems i have narrowed it down to pressing the enter key on keyboard.
if i press the enter key i get a full postback on firefox. but if i click the button i get the effect i want. the ajax request.
but in IE all works fine...
here is javascript code:

  function SendClientMessage() {                   
                    var msgtext = document.getElementById("<%= message.ClientID  %>");
                    if (msgtext != null) {
                        var eventArgs = "AddClientMsg";
                        clientMsgAdded = true;
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(eventArgs);
                    }                   
                }
                function KeyDown(e) {
                    var keyPressed;
                    if (window.event) {
                        keyPressed = window.event.keyCode;
                    } else {
                        keyPressed = e.which;                   
                    }
                    if (keyPressed == 13) // checks whether the ENTER key
                    // is pressed
                    {                    
                        window.event.cancelBubble = true;
                        window.event.returnValue = false;
                        SendClientMessage();
                    }
                }
0
Joshua Gates
Top achievements
Rank 1
answered on 07 Oct 2009, 03:39 PM
anything?
0
Pavlina
Telerik team
answered on 07 Oct 2009, 05:52 PM
Hi Joshua,

As I said in the support ticket - the provided code looks fine to me. Therefore I will ask you to send us a simple runnable application which is working properly in IE and step-by-step instructions how to replicate the issue in Firefox. Thus we could do our best to help you further in resolving it.

Best wishes,
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.
0
Srujana
Top achievements
Rank 1
answered on 16 Aug 2011, 03:11 PM

Hello Telerik Team,

I am seeing the same behavior that was described in the post below.

I have simple javascript function that is called when the modal window is closed, it works fine on IE, but not on Firefox, no javascript errors that I know of, nothing happens when I use firefox. I put  a break point to see if it is reaching the  code in RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e), and it is not reaching there when I use firefox.

 

 

 

function OnModalClose(oWnd, eventArgs)

 

{

$find(

 

"<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindChild");

 

}

 

 

Any input on this is greatly appriciated.

Thanks,
SC.

0
Pavlina
Telerik team
answered on 19 Aug 2011, 01:46 PM
Hi Srujana,

As I said in the previous post, to determine the cause of the problem in Firefox we need a sample project, which we can debug and see what went wrong.

I am looking forward for your reply.

Regards,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Srujana
Top achievements
Rank 1
answered on 19 Aug 2011, 03:34 PM
Hi Pavlina,
Sorry, due to the legal restrictions I can't share my project with outsiders, I could give you a complete walk through to reproduce the issue though.

I have a RadGrid on page, there is button on the Grid when onclick it opens the Radwindow from serverside(code-behind)  like a code below. And then I save some data from modalwindow to Session and Close the window. When I close it, I have a client side event that
function OnModesClose(oWnd, eventArgs) 
       {
           $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindGrid");
       }

<telerik:GridTemplateColumn UniqueName="ModesBtn" HeaderStyle-BorderWidth="1px"
                             ItemStyle-HorizontalAlign="center">
                             <ItemTemplate>
                                 <telerik:RadButton ID="ModesBtn"  runat="server" Text="Modes" CommandArgument='<%#Eval("Stop.Id")%>'
                                     CausesValidation="false"   AutoPostBack="true" OnClick="ModesBtn_OnClick" UseSubmitBehviour="false">
                                     <Icon PrimaryIconUrl="_images/application_view_tile.gif" />
                                 </telerik:RadButton>
                             </ItemTemplate>
                         </telerik:GridTemplateColumn>

 

 

 

 

protected void ModesBtn_OnClick(object sender, EventArgs e)
       {
           RadWindowManager1.Windows.Clear();
           RadButton btn = (RadButton)sender;
           string args = btn.CommandArgument;
           RadWindow window = new RadWindow();
           window.ID = "RadWindow1";
           window.Title = "Modes";
           window.Behaviors = Telerik.Web.UI.WindowBehaviors.Close | Telerik.Web.UI.WindowBehaviors.Maximize | Telerik.Web.UI.WindowBehaviors.Minimize | Telerik.Web.UI.WindowBehaviors.Reload;
           window.NavigateUrl = "Popup.aspx?Id=" + args + "&type=mode";
           window.VisibleOnPageLoad = true;
           window.Modal = true;
           window.Width = 500;
           window.Height = 400;
           window.DestroyOnClose = true;
           window.OnClientClose = "OnModesClose";
           RadWindowManager1.Windows.Add(window);
       }

 

 

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest" EnableAJAX="true">
       <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">   
                       <UpdatedControls>  
                           <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />  
                       </UpdatedControls>  
                   </telerik:AjaxSetting>    
<telerik:AjaxSetting AjaxControlID="RadGrid1">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                   <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
               </UpdatedControls>
           </telerik:AjaxSetting>
             </AjaxSettings>
   </telerik:RadAjaxManager>
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
       {
           if (e.Argument == "RebindGrid")
           {
                  RadGrid1.Rebind();
           }

I problem is that the javascript is not triggering the serverside AjaxRequest above when I use Firefox, it works fine with IE though.

Thanks,
Srujana.

0
Srujana
Top achievements
Rank 1
answered on 19 Aug 2011, 03:34 PM
Hi Pavlina,
Sorry, due to the legal restrictions I can't share my project with outsiders, I could give you a complete walk through to reproduce the issue though.

I have a RadGrid on page, there is button on the Grid when onclick it opens the Radwindow from serverside(code-behind)  like a code below. And then I save some data from modalwindow to Session and Close the window. When I close it, I have a client side event that
function OnModesClose(oWnd, eventArgs) 
       {
           $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindGrid");
       }

<telerik:GridTemplateColumn UniqueName="ModesBtn" HeaderStyle-BorderWidth="1px"
                             ItemStyle-HorizontalAlign="center">
                             <ItemTemplate>
                                 <telerik:RadButton ID="ModesBtn"  runat="server" Text="Modes" CommandArgument='<%#Eval("Stop.Id")%>'
                                     CausesValidation="false"   AutoPostBack="true" OnClick="ModesBtn_OnClick" UseSubmitBehviour="false">
                                     <Icon PrimaryIconUrl="_images/application_view_tile.gif" />
                                 </telerik:RadButton>
                             </ItemTemplate>
                         </telerik:GridTemplateColumn>

 

 

 

 

protected void ModesBtn_OnClick(object sender, EventArgs e)
       {
           RadWindowManager1.Windows.Clear();
           RadButton btn = (RadButton)sender;
           string args = btn.CommandArgument;
           RadWindow window = new RadWindow();
           window.ID = "RadWindow1";
           window.Title = "Modes";
           window.Behaviors = Telerik.Web.UI.WindowBehaviors.Close | Telerik.Web.UI.WindowBehaviors.Maximize | Telerik.Web.UI.WindowBehaviors.Minimize | Telerik.Web.UI.WindowBehaviors.Reload;
           window.NavigateUrl = "Popup.aspx?Id=" + args + "&type=mode";
           window.VisibleOnPageLoad = true;
           window.Modal = true;
           window.Width = 500;
           window.Height = 400;
           window.DestroyOnClose = true;
           window.OnClientClose = "OnModesClose";
           RadWindowManager1.Windows.Add(window);
       }

 

 

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest" EnableAJAX="true">
       <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">   
                       <UpdatedControls>  
                           <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />  
                       </UpdatedControls>  
                   </telerik:AjaxSetting>    
<telerik:AjaxSetting AjaxControlID="RadGrid1">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                   <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
               </UpdatedControls>
           </telerik:AjaxSetting>
             </AjaxSettings>
   </telerik:RadAjaxManager>
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
       {
           if (e.Argument == "RebindGrid")
           {
                  RadGrid1.Rebind();
           }

my problem is that the javascript is not triggering the serverside AjaxRequest above when I use Firefox, it works fine with IE though.

Thanks,
Srujana.

0
Pavlina
Telerik team
answered on 25 Aug 2011, 04:21 PM
Hello Srujana,

I will try to replicate the problem in a sample project, based on the provided code and will get back to you with more information on the matter.

Best wishes,
Pavlina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Srujana
Top achievements
Rank 1
answered on 06 Sep 2011, 02:53 PM
Hello Team,

I just wanted to check if you were able to reproduce the issue, if so, was there a possiblity/ work around to fix the issue.

Please let me know.

Thanks,
Srujana.
0
Iana Tsolova
Telerik team
answered on 08 Sep 2011, 01:41 PM
Hello Srujana,

Unfortunately the AjaxRequest event is properly fired on my side. Can you test the attached sample and let me know how it goes on your end and what differs in your case?
Additionally, can you confirm that you have no javascript errors and that the OnClientClose client-side event handler is properly executed?

All the best,
Iana
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Ajax
Asked by
Joshua Gates
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Joshua Gates
Top achievements
Rank 1
Srujana
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or