zoukankan      html  css  js  c++  java
  • JqueryGridview模板列求和

    gridview中模板列TextBox求和赋值给一个TextBox(txt总维修金额)

    html:

    <Chsoft:SmartGridView ID="gv设备_外协维修合同明细" runat="server" Width="100%" IsShowIndexColumn="true" DataKeyNames="外协维修合同明细ID" AllowPaging="false"
    IsShowExcelLinkButton
    ="false" IsSinglePageDataMode="False"
    UnExportColumns
    ="操作">
    <Columns>
    <asp:TemplateField HeaderText="材料费用">
    <ItemStyle HorizontalAlign="Right" Width="80px" />
    <ItemTemplate>
    <Chsoft:SmartNumericTextBox ID="txt材料费用" DecimalSeparator="Dot" IsAllowDecimals="true"
    Width
    ="60px" runat="server" MaxLength="10" CssClass="class材料费用" IsAllowNegative="false"></Chsoft:SmartNumericTextBox>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="人工费用">
    <ItemStyle HorizontalAlign="Right" Width="80px" />
    <ItemTemplate>
    <Chsoft:SmartNumericTextBox ID="txt人工费用" DecimalSeparator="Dot" IsAllowDecimals="true"
    Width
    ="60px" runat="server" MaxLength="10" CssClass="class人工费用" IsAllowNegative="false"></Chsoft:SmartNumericTextBox>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </Chsoft:SmartGridView>

    JsCode:

    <script language="javascript" type="text/javascript">
    Sys.Application.add_load(function () {
    var classDiscount = $("#<%=gv设备_外协维修合同明细.ClientID %>").contents().find(".class材料费用");
    classDiscount.keyup(function () {
    ChangeText($(this));
    });
    var classDiscount = $("#<%=gv设备_外协维修合同明细.ClientID %>").contents().find(".class人工费用");
    classDiscount.keyup(function () {
    ChangeText($(this));
    });
    function ChangeText(target) {
    var txt总维修金额 = $("#<%=txt总维修金额.ClientID %>");
    if (target.val() != "0") {
    var con = $("#<% =gv设备_外协维修合同明细.ClientID %> :text");
    var count = 0;
    for (var i = 0; i < con.length; i++) {
    count = Number(count) + Number(con[i].value);
    }
    txt总维修金额.val(count);
    }
    }
    });
    </script>
  • 相关阅读:
    windows 服务中托管asp.net core
    asp.net core自定义端口
    asp.net core 2.1 部署IIS(win10/win7)
    Centos7 安装Tomcat并运行程序
    centos7 安装java运行环境
    linux(centos7) 常用命令和快捷键 持续验证更新中...
    CentOS7 设置yum源
    dotnet core 入门命令
    二项式系数学习笔记
    [容斥原理][莫比乌斯反演] Codeforces 803F Coprime Subsequences
  • 原文地址:https://www.cnblogs.com/shenyixin/p/2305458.html
Copyright © 2011-2022 走看看