It doesn't work on google chrome but works fine on IE

It doesn't work on google chrome but works fine on IE

The modal dialog works fine when I click on the gridview row on windows explorer, but it doesn't function at all when I try it on Chrome.


  1. <head id="Head1" runat="server">
  2.     <title>test</title>
  3.    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
  4.     <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  5.     <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>

  6.  
  7.     <style type="text/css">
  8.     
  9.     .ui-widget {
  10.     font-size:10%;
  11. }
  12.     </style>

  13.    <script type="text/javascript">
  14.        $(function () {
  15.            var tr = $('#GridView1').find('tr');
  16.            tr.bind('click', function (event) {
  17.                var tds = $(this).find('td:not(:first-child)');


  18.                $.each(tds, function (index, item) {
  19.                    $('#txtbadd' + (index + 1)).val(item.innerHTML);
  20.                });


  21.            });
  22.        });

  23.        $(function () {
  24.            $("#modialog").dialog({
  25.                autoOpen: false,
  26.                height: 270,
  27.                modal: true,
  28.                buttons: {
  29.                    Update: function () {

  30.                        $.ajax({

  31.                            type: "POST",
  32.                            url: "WebService.asmx/AddToDB",
  33.                            data: "{str1:'" + $("#txtbadd1").val() + "', 'str2': '" + $("#txtbadd2").val() + "', 'str3': '" + $("#txtbadd3").val() + "', 'str4': '" + $("#txtbadd4").val() + "', 'str5': '" + $("#txtbadd5").val() + "', 'str6': '" + $("#txtbadd6").val() + "'}",
  34.                            contentType: "application/json; charset=utf-8",
  35.                            dataType: "json",
  36.                            success: function (msg) {
  37.                                alert(msg.d);
  38.                            }
  39.                        });

  40.                    },
  41.                    Delete: function () {
  42.                        $(this).dialog("close");
  43.                    },
  44.                    Cancel: function () {
  45.                        $(this).dialog("close");
  46.                    }
  47.                }
  48.            });

  49.            $("#GridView1").click(function () {
  50.                $("#modialog").dialog("open");
  51.                return false;
  52.            });
  53.        });

  54.        </script>

  55. </head>
  56. <body>
  57.     <form id="form1" runat="server">
  58.     <p>Last unsaved data:</p><br /><br />

  59.                     <asp:GridView ID="GridView1" runat="server"
  60.                     Width="900px" CellPadding="4" 
  61.                     ForeColor="#333333" GridLines="None">
  62.                     <AlternatingRowStyle BackColor="White" />
  63.                     <Columns>
  64.                         <asp:TemplateField>
  65.                             <ItemTemplate>
  66.                                 <input type="button" id="upbutt" value="edit" />
  67.                             </ItemTemplate>
  68.                 
  69.                         </asp:TemplateField>
  70.                     </Columns>
  71.                     <EditRowStyle BackColor="#7C6F57" />
  72.                     <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
  73.                     <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
  74.                     <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
  75.                     <RowStyle BackColor="#E3EAEB" />
  76.                     <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
  77.                     <SortedAscendingCellStyle BackColor="#F8FAFA" />
  78.                     <SortedAscendingHeaderStyle BackColor="#246B61" />
  79.                     <SortedDescendingCellStyle BackColor="#D4DFE1" />
  80.                     <SortedDescendingHeaderStyle BackColor="#15524A" />
  81.                 </asp:GridView>
  82.  


  83.                 <div id="modialog" title="Modify selected row." >
  84.                 <table>
  85.                 <tr>
  86.                 <td><asp:Label ID="Label1" runat="server" Text="ID:"></asp:Label> </td>
  87.                 <td><asp:TextBox ID="txtbadd1" runat="server" ReadOnly="true"></asp:TextBox></td>
  88.                 </tr>
  89.                 <tr>
  90.                     
  91.                 <td><asp:Label ID="Label2" runat="server" Text="Name:"></asp:Label> </td>
  92.                 <td><asp:TextBox ID="txtbadd2" runat="server"></asp:TextBox></td>
  93.                 </tr>
  94.                 <tr>
  95.                 <td><asp:Label ID="Label3" runat="server" Text="Code:"></asp:Label> </td>
  96.                 <td><asp:TextBox ID="txtbadd3" runat="server"></asp:TextBox></td>
  97.                 </tr>
  98.                 <tr>
  99.                 <td><asp:Label ID="Label4" runat="server" Text="Address:"></asp:Label> </td>
  100.                 <td><asp:TextBox ID="txtbadd4" runat="server"></asp:TextBox></td>
  101.                 </tr>
  102.                 <tr>
  103.                 <td><asp:Label ID="Label5" runat="server" Text="Phone:"></asp:Label> </td>
  104.                 <td><asp:TextBox ID="txtbadd5" runat="server"></asp:TextBox></td>
  105.                 </tr>
  106.                 <tr>
  107.                 <td><asp:Label ID="Label6" runat="server" Text="nthg:"></asp:Label> </td>
  108.                 <td><asp:TextBox ID="txtbadd6" runat="server"></asp:TextBox></td>
  109.                 </tr>
  110.                 </table>
  111.                 </div>
  112.     </form>



  113.               
  114.    
  115. </body>
  116. </html>