【问题标题】:ASP.Net jquery TextBox EventASP.Net jquery 文本框事件
【发布时间】:2021-11-03 17:27:33
【问题描述】:

我可以在 asp.net 中使用 jquery 将文本框更改事件称为文本更改吗?
所以,我希望在用户输入数字时完成操作。

Default.aspx

<asp:TextBox ID="txtCount" CssClass="form-control" runat="server"></asp:TextBox>
<asp:TextBox ID="txtPrice" CssClass="form-control" runat="server" OnTextChanged="OnTextChanged"></asp:TextBox>
<asp:Label ID="lblTotal" CssClass="price" runat="server"></asp:Label>

Default.aspx.cs

protected void txtIskontoTutari_TextChanged(object sender, EventArgs e)
{
    double price1=double.Parse(txtPrice.Text);
    double count=double.Parse(txtCount.Text);
    double total=0;
    total=price1*count;
    lblTotal.Text = string.Format("{0:#,##0.00}", total);
}

【问题讨论】:

    标签: c# jquery asp.net textbox asp.net-ajax


    【解决方案1】:

    这可能是解决方案:
    你确实需要你的 asp 标签的 ID 属性。

    $(document).ready(function () {
        $('#txtPrice').change(function(){
          $(this).....
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多