本文介绍了在jquery中生成textchanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有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中的这个事件函数解决方案 在代码中使用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事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-28 21:07