zoukankan      html  css  js  c++  java
  • 通过JS触发TextBox的ontextchanged事件,并获取TextBox所在GridView的那一行

     protected void txtInsNum_TextChanged(object sender, EventArgs e)
        {
            TextBox t = (TextBox)sender;
    
            GridViewRow drv = (GridViewRow)t.NamingContainer;
    
            int rowIndex = drv.RowIndex;
           
    
          
        }
     function txtInsNum(txt) {
                var td = txt.parent();
                var InsNumTotal = td.find("input:eq(3)");
                InsNumTotal.val(td.find("input:eq(0)").val() * 1 + td.find("input:eq(1)").val() * 1 + td.find("input:eq(2)").val() * 1); 
    InsNumTotal.change(); }
      <asp:TemplateField HeaderText="ORDER QTY READY FOR INSPECTION">
        <ItemTemplate>
            <asp:TextBox ID="txtInsNum1" onblur="txtInsNum($(this))"  runat="server" ></asp:TextBox>
             <asp:TextBox ID="txtInsNum2" onblur="txtInsNum($(this))"   runat="server" ></asp:TextBox>
            <asp:TextBox ID="txtInsNum3" onblur="txtInsNum($(this))"   runat="server" ></asp:TextBox>
             <asp:TextBox ID="txtInsNumTotal" AutoPostBack="true" Enabled="false" OnTextChanged="txtInsNum_TextChanged" runat="server" ></asp:TextBox>
        </ItemTemplate>
    </asp:TemplateField>

    需要注意 txtInsNumTotal 控件的 AutoPostBack="true"   

    纯粹记录,以免以后又忘记了

  • 相关阅读:
    spoj705
    bzoj2440
    spoj220
    bzoj2301
    hdu1695
    poj3294
    hdu3518
    poj3693
    函数
    样式
  • 原文地址:https://www.cnblogs.com/bizprosdd/p/3554489.html
Copyright © 2011-2022 走看看