可以在没有回发的情况下对文本框的事件进行textchanged事件 [英] can textchanged event of textbox fires without postback
本文介绍了可以在没有回发的情况下对文本框的事件进行textchanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在用户在文本框中输入数量时计算总金额..当回发发生但我想动态地执行它而不回发..是否有任何其他解决方案PLZ告诉我。
< br $>
//源代码
I want calculate total amount when user enters quantity in textbox..it works when postback occurs but i want to do it dynamically without postback..is there any another solution plz tell me.
//source code
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:TextBox ID="TxtATQuantityATC" runat="server" AutoPostBack="true" OnTextChanged="TxtATQuantityATC_TextChanged" ></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TxtATQuantityATC" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
//.cs
//.cs
protected void TxtATQuantityATC_TextChanged(object sender, EventArgs e)
{
int Price = int.Parse(LblATUPriceATC.Text);
int Quantity = int.Parse(TxtATQuantityATC.Text);
int TotalPrice = Quantity * Price;
LblATTotalAmntATC.Text = TotalPrice.ToString();
MpeAddToCart.Show();
}
推荐答案
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
( document )。ready( function (){
(document).ready(function(){
( #txtQuantity)。blur( function (){
var price =
("#txtQuantity").blur(function(){ var price =
这篇关于可以在没有回发的情况下对文本框的事件进行textchanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文