简体   繁体   English

文本框 TextChangedEvent 没有触发?

[英]Textbox TextChangedEvent not firing?

I'm working on a basic eCommerce site and I am looking for some help regarding a live calculation that needs to be made when the user enters a numeric value into a text box.我在一个基本的电子商务网站上工作,我正在寻找一些关于当用户在文本框中输入数值时需要进行的实时计算的帮助。

Currently I have set the calculation the happen in a TextChanged event tied to the textbox but this does not seem to be working???目前我已经将计算设置为在与文本框相关的 TextChanged 事件中发生,但这似乎不起作用??? I am wondering if I need to set auto postback to true but I would like the avoid reloading the page if it can be helped!!!我想知道是否需要将自动回发设置为 true,但如果可以帮助,我希望避免重新加载页面!!!

Any help would be great!任何帮助都会很棒! Here is the code behind the button这是按钮后面的代码

 protected void TB_Quantity_TextChanged(object sender, EventArgs e)
{
    LB_price.Text = 
       (int.Parse(ViewState["Price"].ToString()) * 
          int.Parse(TB_Quantity.Text.Trim())).ToString();
}

You can not fire an asp.net event without post back the page to the server.如果不将页面回发到服务器,则无法触发 asp.net 事件。

However, if you need the posting back to be invisible to the user, you may need to use Partial Page Update .但是,如果您需要回帖对用户不可见,则可能需要使用Partial Page Update

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM