在javascript中消防textchanged事件 [英] Fire textchanged event in javascript

查看:68
本文介绍了在javascript中消防textchanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用asp.net Repeater with table来填充数据库中的项目和Ajax的DropDownExtender。当用户单击文本框时,已显示带有html数据的数据。现在,我想在选择数据行时触发textbox的textchanged事件。我在page_load中将数据绑定到转发器。



谢谢所有



我尝试过:


javascript中的
,我在表格行上调用了以下脚本





代码落后(textchanged event)



试试

{

txtUnit.Value = ;

txtItemDescription.Value =;

txtPrice.Value =;



txtQuantity .Text =;

txtAmount.Value =;

txtQuantity.Enabled = false;



cmd = new SqlCommand(select * from item where ItemID ='+ ddlItemID.SelectedItem.Text +',con);

DataTable dtn = new DataTable();

cmd.CommandType = CommandType.Text;

adp.SelectCommand = cmd;

adp.Fill(dtn);

txtUnit.Value = dtn.Rows [0] [Unit]。ToString();

txtItemDescription.Value = dtn.Rows [0] [ItemDescription]。ToString();

txtPrice.Value = dtn.Rows [0] [Price]。ToString();

txtQuantity.Focus();

txtQuantity.Enabled = true;

txtQuantity.Text =;



}

catch(例外)

{

throw;

}

in my application, I used asp.net Repeater with table to populate item from database and DropDownExtender of Ajax. When user clicks on textbox, data with html data have been shown.Now I want to fire textchanged event of textbox when data row is selected. I bind data to repeater in page_load.

Thanks All

What I have tried:

in javascript, I called the following script on row of table


code behind(textchanged event)

try
{
txtUnit.Value = "";
txtItemDescription.Value = "";
txtPrice.Value = "";

txtQuantity.Text = "";
txtAmount.Value = "";
txtQuantity.Enabled = false;

cmd = new SqlCommand("select * from item where ItemID='" + ddlItemID.SelectedItem.Text + "'", con);
DataTable dtn = new DataTable();
cmd.CommandType = CommandType.Text;
adp.SelectCommand = cmd;
adp.Fill(dtn);
txtUnit.Value = dtn.Rows[0]["Unit"].ToString();
txtItemDescription.Value = dtn.Rows[0]["ItemDescription"].ToString();
txtPrice.Value = dtn.Rows[0]["Price"].ToString();
txtQuantity.Focus();
txtQuantity.Enabled = true;
txtQuantity.Text = "";

}
catch (Exception)
{
throw;
}

推荐答案

尝试来自javascript的TextChanged事件 [ ^ ]


这篇关于在javascript中消防textchanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆