在jquery中生成textchanged事件 [英] Generate textchanged events in jquery
本文介绍了在jquery中生成textchanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有20个textchanged像(txtDescription1_TextChanged .............. txtDescription20_TextChanged>
事件,如下面的代码。通过这样做结果应该来得非常慢我希望这个事件在jquery代码中可以帮助任何人........
protected void txtDescription1_TextChanged( object sender,EventArgs e)
{
DataTable qpdataset1 = new DataTable();
if (!txtDescription1.Text.Equals( String .Empty)&&(drpdownlistState.Text.Equals( 增值税销售)))
{
txtVatPercent1.Text = 5 ;
txtSno1.Text = 1;
}
else if (!txtDescription1.Text.Equals ( String .Empty)&&(drpdownlistState.Text.Equals( CST SALES)))
{
txtVATAmt1.Text = 2\" 跨度>;
txtSno1.Text = 1;
}
else
{
txtVatPercent1.Text = ;
txtSno1.Text = 1;
}
string desname = txtDescription1.Text.ToString();
qpdataset1 = getqtyandprice(desname);
DataSet dsCustomerChecking = GetRequiredDataTable( SELECT * FROM TAXINVOICE,其中CUSTOMERNAME =' + txtcustomername。 Text.Trim()+ ');
if (dsCustomerChecking.Tables [ 0 ]。Rows.Count > 0 )
{
if (qpdataset1.Rows.Count > 0 )
{
txtPrice1.Text = qpdataset1.Rows [ 0 ] [ 单价跨度>]的ToString();
DropDownListUOM1.Text = qpdataset1.Rows [ 0 ] [ UOM跨度>]的ToString();
}
}
}
我尝试过:
i我是jquery的新手我不知道jquery中的这个事件函数
解决方案
< blockquote>
在代码中使用Jquery ajax将所有表单输入传递给webmetod。
这是克林特边码
(。txtDescription)。on('change',function(){
if(
(this).val()==''&&
i have 20 textchanged like (txtDescription1_TextChanged..............txtDescription20_TextChanged>
events like below code.by doing like this the result should come very slowly i want this event in jquery code can u plz help any one........
protected void txtDescription1_TextChanged(object sender, EventArgs e) { DataTable qpdataset1 = new DataTable(); if (!txtDescription1.Text.Equals(String.Empty) && (drpdownlistState.Text.Equals("VAT SALES"))) { txtVatPercent1.Text = "5"; txtSno1.Text = "1"; } else if (!txtDescription1.Text.Equals(String.Empty) && (drpdownlistState.Text.Equals("CST SALES"))) { txtVATAmt1.Text = "2"; txtSno1.Text = "1"; } else { txtVatPercent1.Text = ""; txtSno1.Text = "1"; } string desname = txtDescription1.Text.ToString(); qpdataset1 = getqtyandprice(desname); DataSet dsCustomerChecking = GetRequiredDataTable("SELECT * FROM TAXINVOICE where CUSTOMERNAME = '" + txtcustomername.Text.Trim() + "'"); if (dsCustomerChecking.Tables[0].Rows.Count > 0) { if (qpdataset1.Rows.Count > 0) { txtPrice1.Text = qpdataset1.Rows[0]["UnitPrice"].ToString(); DropDownListUOM1.Text = qpdataset1.Rows[0]["UOM"].ToString(); } } }
What I have tried:
i am new in jquery i have no idea about on this events functions in jquery解决方案use Jquery ajax in your code pass all the form inputs to your webmetod. Here is Clint side code
(".txtDescription").on('change', function() { if(
(this).val()=='' &&
这篇关于在jquery中生成textchanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文