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.
- <head id="Head1" runat="server">
- <title>test</title>
- <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
- <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
- <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
-
- <style type="text/css">
-
- .ui-widget {
- font-size:10%;
- }
- </style>
- <script type="text/javascript">
- $(function () {
- var tr = $('#GridView1').find('tr');
- tr.bind('click', function (event) {
- var tds = $(this).find('td:not(:first-child)');
- $.each(tds, function (index, item) {
- $('#txtbadd' + (index + 1)).val(item.innerHTML);
- });
- });
- });
- $(function () {
- $("#modialog").dialog({
- autoOpen: false,
- height: 270,
- modal: true,
- buttons: {
- Update: function () {
- $.ajax({
- type: "POST",
- url: "WebService.asmx/AddToDB",
- data: "{str1:'" + $("#txtbadd1").val() + "', 'str2': '" + $("#txtbadd2").val() + "', 'str3': '" + $("#txtbadd3").val() + "', 'str4': '" + $("#txtbadd4").val() + "', 'str5': '" + $("#txtbadd5").val() + "', 'str6': '" + $("#txtbadd6").val() + "'}",
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: function (msg) {
- alert(msg.d);
- }
- });
- },
- Delete: function () {
- $(this).dialog("close");
- },
- Cancel: function () {
- $(this).dialog("close");
- }
- }
- });
- $("#GridView1").click(function () {
- $("#modialog").dialog("open");
- return false;
- });
- });
- </script>
- </head>
- <body>
- <form id="form1" runat="server">
- <p>Last unsaved data:</p><br /><br />
- <asp:GridView ID="GridView1" runat="server"
- Width="900px" CellPadding="4"
- ForeColor="#333333" GridLines="None">
- <AlternatingRowStyle BackColor="White" />
- <Columns>
- <asp:TemplateField>
- <ItemTemplate>
- <input type="button" id="upbutt" value="edit" />
- </ItemTemplate>
-
- </asp:TemplateField>
- </Columns>
- <EditRowStyle BackColor="#7C6F57" />
- <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
- <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
- <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
- <RowStyle BackColor="#E3EAEB" />
- <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
- <SortedAscendingCellStyle BackColor="#F8FAFA" />
- <SortedAscendingHeaderStyle BackColor="#246B61" />
- <SortedDescendingCellStyle BackColor="#D4DFE1" />
- <SortedDescendingHeaderStyle BackColor="#15524A" />
- </asp:GridView>
-
- <div id="modialog" title="Modify selected row." >
- <table>
- <tr>
- <td><asp:Label ID="Label1" runat="server" Text="ID:"></asp:Label> </td>
- <td><asp:TextBox ID="txtbadd1" runat="server" ReadOnly="true"></asp:TextBox></td>
- </tr>
- <tr>
-
- <td><asp:Label ID="Label2" runat="server" Text="Name:"></asp:Label> </td>
- <td><asp:TextBox ID="txtbadd2" runat="server"></asp:TextBox></td>
- </tr>
- <tr>
- <td><asp:Label ID="Label3" runat="server" Text="Code:"></asp:Label> </td>
- <td><asp:TextBox ID="txtbadd3" runat="server"></asp:TextBox></td>
- </tr>
- <tr>
- <td><asp:Label ID="Label4" runat="server" Text="Address:"></asp:Label> </td>
- <td><asp:TextBox ID="txtbadd4" runat="server"></asp:TextBox></td>
- </tr>
- <tr>
- <td><asp:Label ID="Label5" runat="server" Text="Phone:"></asp:Label> </td>
- <td><asp:TextBox ID="txtbadd5" runat="server"></asp:TextBox></td>
- </tr>
- <tr>
- <td><asp:Label ID="Label6" runat="server" Text="nthg:"></asp:Label> </td>
- <td><asp:TextBox ID="txtbadd6" runat="server"></asp:TextBox></td>
- </tr>
- </table>
- </div>
- </form>
-
-
- </body>
- </html>