Ajax problem with Safari and Q2 2013

3 posts, 0 answers
  1. Brete
    Brete avatar
    33 posts
    Member since:
    Feb 2008

    Posted 18 Jul 2013 Link to this post

    I have encountered an problem only occurs if the user is using Safari.   In a Radwindow.    Once the user makes a choice in the ajaxified drop down the ajax disabled button no longer posts back.     If the user does not make a choice in the drop down the button post back.   Below is the code,

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="SafariBugTest2.aspx.cs" Inherits="SafariBugTest2" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
         
           
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <script type="text/javascript">
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }
     
            function CloseAndRebind(args) {
                GetRadWindow().BrowserWindow.refreshGrid(args);
                GetRadWindow().close();
            }
     
     
     
            function returnToParent() {
                //create the argument that will be returned to the parent page
                var oArg = new Object();
     
     
                var oWnd = GetRadWindow();
     
                //set the argument to the RadWindow
                oWnd.argument = oArg;
                //close the RadWindow           
                {
                    oWnd.close();
                }
     
            }
     
            function inconditionalPostback(sender, args) {
                //    var targ = "";
                //  alert(args.EventTarget);
                //  alert(args.EventArgument);
                var targ = args.EventTarget;
                var ntarg = targ.toUpperCase()
                var ic = ntarg.indexOf("UPBUTTON");
     
                if (ic > 0) {
     
     
                    args.EnableAjax = false;
                } else {
                    args.EnableAjax = true;
                }
            }
        </script>
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="inconditionalPostback">
            <div>
                <table width=350>
                    <tr>
                        <td>
                            <asp:Label ID="Label1" runat="server" Text="Order Routing"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table>
                                <tr>
                                    <td>
                                        <asp:Label ID="Label2" runat="server" Text="Route Order to:"></asp:Label>
                                    </td>
                                    <td>
                                        <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
                                        </telerik:RadComboBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label ID="Label3" runat="server" Text="Send alert to:"></asp:Label>
                                    </td>
                                    <td>
                                        <telerik:RadComboBox ID="RadComboBox2" EnableCheckAllItemsCheckBox="true" runat="server"
                                            CheckBoxes="True">
                                        </telerik:RadComboBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table id="iscompliance" runat="server" visible="false">
                                <tr>
                                    <td>
                                        <asp:Label ID="Label6" runat="server" Text="Enter Compliance ID"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>   <asp:TextBox ID="TextBox2" runat="server"  TextMode=SingleLine Width="345px"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label4" runat="server" Text="Notes"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:TextBox ID="TextBox1" runat="server" Height="121px" TextMode="MultiLine" Width="345px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label5" runat="server" Text="Use the Upload below to add any new resources, needed for this order"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />
                            <telerik:RadProgressArea ID="RadProgressArea1" runat="server" Skin="WebBlue" CssClass="upldr"
                                ProgressIndicators="TotalProgressBar, TotalProgress, TotalProgressPercent, RequestSize, TimeElapsed, TimeEstimated, TransferSpeed"
                                ToolTip="Upload Progress">
                                <Localization Uploaded="Uploaded"></Localization>
                            </telerik:RadProgressArea>
                           <%-- <telerik:RadUpload ID="RadUpload1" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="10"
                                ControlObjectsVisibility="AddButton" OverwriteExistingFiles="True" TargetFolder="thrivent\temp">
                            </telerik:RadUpload>--%>
                            <asp:HiddenField ID="HiddenUplist" runat="server" />
                                              <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellSpacing="0"
                                            GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource" Width="400px" OnInsertCommand="RadGrid1_InsertCommand">
                                            <ClientSettings>
                                                <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="100px" />
                                            </ClientSettings>
                                            <MasterTableView DataKeyNames="Resource_ID" CommandItemDisplay="Bottom">
                                                <CommandItemSettings ExportToPdfText="Export to PDF" />
                                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                                </RowIndicatorColumn>
                                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                                </ExpandCollapseColumn>
                                                <Columns>
                                                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" UniqueName="TemplateColumn"
                                                        HeaderText="Current attachments to this request">
                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="UPBUTTON3" runat="server" OnClick="LinkB3_Click" Text='<%# Bind( "Resource_Filename") %>'></asp:LinkButton>
                                                        </ItemTemplate>
                                                    </telerik:GridTemplateColumn>
                                                   
                                                </Columns>
                                                <EditFormSettings EditFormType="Template">
                                                    <FormTemplate>
                                                        <table width="350">
                                                            <tr>
                                                                <td>
                                                                    <telerik:RadUpload ID="RadUpload1" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1"
                                                                        ControlObjectsVisibility="None" OverwriteExistingFiles="True" TargetFolder="thrivent\temp"
                                                                        EnableFileInputSkinning="False">
                                                                    </telerik:RadUpload>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <asp:Button ID="MYUPBUTTON" runat="server" Text="Upload" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </FormTemplate>
                                                </EditFormSettings>
                                                <CommandItemTemplate>
                                                    <asp:Button ID="Button2" runat="server" Text="Upload New Resource" CommandName="InitInsert" />
                                                </CommandItemTemplate>
                                            </MasterTableView>
                                            
                                            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                                            </HeaderContextMenu>
                                        </telerik:RadGrid>
     
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label16" runat="server" CssClass="small_text" Text="If you need to upload more than 5 files, click the Add Button.  Empty upload boxes will be ignored. "></asp:Label>
                        </td>
                    </tr>
                    <tr>
                    <td>
                    <table width=300>
                     <tr>
                        <td width=200>
                            <asp:HiddenField ID="HiddenST" runat="server" />
                            <asp:HiddenField ID="HiddenID" runat="server" />
                            <asp:Button ID="Button1" runat="server" Text="Cancel" OnClick="Button1_Click" />
                        </td>
                        <td>
                            <asp:Button ID="MYUPBUTTON" runat="server" Text="Route" OnClick="Button2_Click" />
                        </td>
                    </tr>
                    </table>
                    </td>
                    </tr>
                    
                </table>
            </div>
        </telerik:RadAjaxPanel>
         
        </form>
    </body>
    </html>

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Data;
    using System.Net.Mail;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
     
    public partial class SafariBugTest2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["RID"] != null)
                {
                    //   Label2.Text = "Order ID " + Request.QueryString["RID"].ToString();
                    HiddenID.Value = Request.QueryString["RID"].ToString();
                    BuildRoutes();
     
                }
            }
        }
        private void BuildRoutes()
        {
     
            DataTable p1 = new DataTable("Temp");
     
            p1.Columns.Add("Role_words", typeof(String));
            p1.Columns.Add("Role_xor", typeof(String));
            for(int x =1;x<=10;x++)
            {
                DataRow row;
                row = p1.NewRow();
     
                row["Role_words"] = "Test "+x.ToString();
                row["Role_xor"] = "Test " + x.ToString();
                
                p1.Rows.Add(row);
     
            }
     
            
     
     
            RadComboBox1.DataSource = p1;
     
            RadComboBox1.DataTextField = "Role_words";
            RadComboBox1.DataValueField = "Role_xor";
            RadComboBox1.DataBind();
            RadComboBox1_SelectedIndexChanged(null, null);
     
     
     
     
        }
        protected void LinkB3_Click(object sender, EventArgs e)
        {
           
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            RadAjaxPanel1.ResponseScripts.Add("returnToParent()");
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            /*
              Do some work here
             * */
     
     
            RadAjaxPanel1.ResponseScripts.Add(" CloseAndRebind('Rebind')");
        }
        protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
          
        }
        protected void RadGrid1_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
     
        }
        protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            
     
        }
    }
  2. Brete
    Brete avatar
    33 posts
    Member since:
    Feb 2008

    Posted 18 Jul 2013 Link to this post

    This problem only occurs in Q2 2013.  The code worked correctly using Q1 2013 or older versions. 
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Jul 2013 Link to this post

    Hi Brete,

    Could you please inspect the response from the server and verify if any java script error appeared after the first Ajax request? I suppose that this may be the cause of the unresponsive behavior of the button. Also please try to use regular asp UpdatePanel instead of RadAjaxPanel and verify if this makes any difference.

    Regards,
    Maria Ilieva
    Telerik
    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 the blog feed now.
Back to Top