基于2个文本框,我有10个文本框,我想在不使用按钮的情况下生成第三个Texbox值 [英] I Have 10 Textboxes Among Them Based On 2 Textbox I Want To Generate Third Texbox Values Without Using Button
本文介绍了基于2个文本框,我有10个文本框,我想在不使用按钮的情况下生成第三个Texbox值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
第一个文本框值25
第二个文本框值05然后我想在第三个文本框中绑定thei值而不使用Button ....
如何做到这一点
解决方案
在TextChanged事件中写下你的逻辑它会起作用
喜欢
< pre lang =cs> protected void TextBox1_TextChanged( object sender,EventArgs e)
{
textbox3.text = textbox1.text + textbox2.text;
}
还使用类型转换
使用以下代码:
受保护 void TextBox1_TextChanged( object sender,EventArgs e)
{
if (textbox1.text.trim()!= ' '&&&textframe2 .text.trim()!= ' ')
textbox3.text = Convert.ToInt32 (textbox1.text)+ Convert.ToInt32(textbox2.text);
}
受保护 void TextBox2_TextChanged( object <> span sender,EventArgs e)
{
if (textbox1.text.trim( )!= ' '&& textbox2.text.trim()!= )
textbox3.text = Convert.ToInt32(textbox1.text)+ Convert.ToInt32(textbox2。文本);
}
< title>
/////// //////////////////////// jquery添加和显示的功能
1st textbox value 25
2nd textbox value 05 then i wanna bind thei Sum values in Third textbox without using Button ....
How to do this
解决方案
Write your logic at TextChanged event it will work
like
protected void TextBox1_TextChanged(object sender, EventArgs e) { textbox3.text=textbox1.text+textbox2.text; }
use type casting also
Use following code :
protected void TextBox1_TextChanged(object sender, EventArgs e) { if(textbox1.text.trim()!='' && textbox2.text.trim()!='') textbox3.text=Convert.ToInt32(textbox1.text)+Convert.ToInt32(textbox2.text); } protected void TextBox2_TextChanged(object sender, EventArgs e) { if(textbox1.text.trim()!='' && textbox2.text.trim()!='') textbox3.text=Convert.ToInt32(textbox1.text)+Convert.ToInt32(textbox2.text); }
<title>
///////////////////////////////jquery function to add and display
这篇关于基于2个文本框,我有10个文本框,我想在不使用按钮的情况下生成第三个Texbox值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文