zoukankan      html  css  js  c++  java
  • GridView里的文本框改变事件

    <asp:TemplateField HeaderText="实收数量">
    <ItemTemplate>
    <asp:TextBox ID="txtorgqty" runat="server" Text='<%# string.Format("{0:0.##}",Eval("orgqty")) %>'
    Width="100px" Visible="false" AutoPostBack="true" OnTextChanged="txtorgqty_TextChanged"></asp:TextBox>
    <%-- <asp:CheckBox ID="cbGV" runat="server" Enabled='<%# ViewState["DocnoStatus"].ToString()=="OP"?true:false %>' AutoPostBack="true" oncheckedchanged="ItemCheckBox_CheckedChanged" /> --%>

    <asp:Label ID="lblorgqty" runat="server" Text='<%# string.Format("{0:0.##}",Eval("orgqty")) %>'
    Visible="true"></asp:Label>
    </ItemTemplate>

    protected void txtorgqty_TextChanged(object sender, EventArgs e)
    {
    TextBox txtorgqty = (TextBox)sender;
    // Page.ClientScript.RegisterStartupScript(typeof(string), "msg", "<script>alert('触发txtorgqty_TextChanged事件 "+txtorgqty.Text+"!')</script>");

    int index = ((GridViewRow)(txtorgqty.NamingContainer)).RowIndex;
    GridViewRow row = GridView1.Rows[index];
    Label lblacphigh = (Label)row.Cells[11].FindControl("lblacphigh"); //上限(%)
    double dacphigh = (double.Parse(lblacphigh.Text.Trim())) / 100;//上限除100后
    Label lblqty1 = (Label)row.Cells[9].FindControl("lblqty1"); //待收
    double tsqty = (double.Parse(lblqty1.Text.Trim())) * (1 + dacphigh);
    if ((double.Parse(txtorgqty.Text.Trim())>tsqty))
    {
    Page.ClientScript.RegisterStartupScript(typeof(string), "msg", "<script>alert('实收数量超过上限!')</script>");
    txtorgqty.Focus();
    BtnSave.Enabled = false;
    //Session["btnsaveEnabled"] = false;
    }
    else
    {
    BtnSave.Enabled = true ;
    // Session["btnsaveEnabled"] = true;


    }
    }

  • 相关阅读:
    冒泡排序
    跑马(行转列,列转行)
    选择排序
    day06-迭代器
    day05-装饰器作业
    day07-生成器
    day08-内置函数和匿名函数
    day09-正侧表达式
    144-SpringBoot的编码问题?
    143-SprinBoot如何使用Servlet?
  • 原文地址:https://www.cnblogs.com/buy0769/p/5667812.html
Copyright © 2011-2022 走看看