码迷,mamicode.com
首页 > 其他好文 > 详细

GridView里的文本框改变事件

时间:2016-07-13 20:26:54      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

 

<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;


}
}

GridView里的文本框改变事件

标签:

原文地址:http://www.cnblogs.com/buy0769/p/5667812.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!