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>
  • 相关阅读:
    textarea中的空格与换行
    js判断微信内置浏览器
    关于express4不再支持body-parser
    html5 geolocation API
    屏幕密度与分辨率
    nodebeginer
    手机浏览器下IScroll中click事件
    iphone手机上的click和touch
    AngularJS学习笔记一
    不用bootstrap实现居中适应
  • 原文地址:https://www.cnblogs.com/shenyixin/p/2305458.html
Copyright © 2011-2022 走看看