默认为第四个文本框中的三个文本框的总和 [英] sum of three text box velues in to fourth text box defaulty
本文介绍了默认为第四个文本框中的三个文本框的总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此aspx页位于内容占位符下,不支持javascript
如何解决这个问题
this aspx page is under content place holder not supported javascript
how to resolve this probles
protected void txtOSITotalIncome_TextChanged(object sender, EventArgs e)
{
string no1 = txtOSIInterstFromBank.Text;
string no2 = txtOSITDSFromBank.Text;
string no3 = txtOSIInterestFromDebent.Text;
txtOSITotalIncome.Text = (no1 + no2 + no3);
}
推荐答案
你好
这不是一个很明确的问题,但是:
如果要在内容页面中使用javascript,则:
在内容页面中调用Page.ClientScriptManager.RegistgerClientScriptBlock
如果您的问题是树文本框的总和,则需要将其值解析为int或double或...
例如
Hello
Not a really clear question but:
If you want javascript in content page then:
callPage.ClientScriptManager.RegistgerClientScriptBlock
in content page
And if your problem is Sum of tree textboxes then you need to Pars their value to int or double or ...
for example
int number1 = 0;
int number2 = 0;
int number3 = 0;
int.TryParse(OSIInterstFromBank.Text, out number1);
int.TryParse(txtOSITDSFromBank.Text, out number2);
...
string + string = stringstring SumOfStrings<br />
int + int + int = SumOf3int<br />
number + number = SumOf2numbers
您看到我要告诉"您的内容吗?
要添加3个数字,您需要声明数字变量,然后将其转换为字符串.
Do you see what i''m trying to "tell" you?
To add 3 numbers you need to declare number variable, then convert it into string.
您的代码只会连接字符串,不会给出总和.
试试:
Hi,
Your code will just concatenate the strings, it will not give sum.
Try:
int no1 = Convert.ToInt32(txtOSIInterstFromBank.Text);
int no2 = Convert.ToInt32(txtOSITDSFromBank.Text);
int no3 = Convert.ToInt32(txtOSIInterestFromDebent.Text);
int no4 = (no1 + no2 + no3);
txtOSITotalIncome.Text=no4.ToString();
快乐编码:)
Happy Coding :)
这篇关于默认为第四个文本框中的三个文本框的总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文