如果将网格保留在表中,我试图做的我的jQuery无法正常工作 [英] my jquery which iam trying to do is not working if keep the grid in a table

查看:60
本文介绍了如果将网格保留在表中,我试图做的我的jQuery无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js">
    </script>
    <script type="text/javascript">

        $(function () {
            alert("dddd");
            //Column index value of price field (Column index start from 1)
            var columnIndexValue = 2;

            var checked = $('input:checkbox').click(function (e) {
                alert("ssddf");
                var total = 0;
                $("tr:has(:checkbox:checked) td:nth-child(" + columnIndexValue + ")").each(function () {
                    total += parseInt($(this).text());
                    alert(total);
                });

                $('#txttotal').val(total.toFixed());


            });

        });


    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table  >
            <tr>
                <td>
                    <table>
                        <tr>
                            <td>
                                <table>
                                    <tr>
                                        <td >
                                            <asp:GridView ID="gvAvail" Width="500px" CssClass="tableView" runat="server" ShowHeader="False"

                                                ShowFooter="True" GridLines="None" AutoGenerateColumns="False" CellPadding="4"

                                                CellSpacing="1" AllowSorting="True">
                                                <Columns>
                                                    <asp:TemplateField>
                                                        <%--<EditItemTemplate>
                                                            <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("selected") %>' />
                                                        </EditItemTemplate>--%>
                                                        <ItemTemplate>
                                                            <asp:CheckBox ID="CheckBox1" runat="server" Enabled="true" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Price" ItemStyle-VerticalAlign="Top">
                                                        <%--<EditItemTemplate>
                                                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("price") %>'></asp:TextBox>
                                                        </EditItemTemplate>--%>
                                                        <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
                                                        <ItemTemplate>
                                                            <img src="images/rupeesymbol.jpg" alt="" />
                                                            <%#Eval("EmpSalary") %>
                                                            /-
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                                <HeaderStyle HorizontalAlign="Left" />
                                                <FooterStyle HorizontalAlign="Left" />
                                                <AlternatingRowStyle BackColor="WhiteSmoke" Wrap="True" />
                                            </asp:GridView>
                                            <asp:TextBox ID="txttotal" runat="server"></asp:TextBox>

                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <asp:Button ID="btnAddcart" runat="server" Text="Add To Cart" Font-Bold="True" Font-Names="Verdana"

            Font-Size="Medium" Height="36px" OnClick="btnAddcart_Click" Width="128px" />
    </div>
    </form>
</body>
</html>






我仅参考
[^ ]

我的任务也一样我想要同样的输出请帮我,我是一个更新鲜的






i reffered to this website only
[^]

my task is also same i want the same out put please help me i am a fresher

推荐答案

(函数(){ alert(" ); // 价格字段的列索引值(列索引从1开始) var columnIndexValue = 2 ; var 已选中=
(function () { alert("dddd"); //Column index value of price field (Column index start from 1) var columnIndexValue = 2; var checked =


(' 功能(e){ alert(" ); var total = 0 ;
('input:checkbox').click(function (e) { alert("ssddf"); var total = 0;


( tr:has(:checkbox:checked)td:nth-​​child(" + columnIndexValue + )").each( parseInt (
("tr:has(:checkbox:checked) td:nth-child(" + columnIndexValue + ")").each(function () { total += parseInt(


这篇关于如果将网格保留在表中,我试图做的我的jQuery无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆