Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
this aspx page is under content place holder not supported javascript
how to resolve this probles

C#
 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);

}
Posted
Updated 14-May-12 19:50pm
v3
Comments
Sandeep Mewara 14-May-12 13:54pm    
Above code is server side code - what is the issue? Why have you tagged it Javascript? What are you looking for - it's not clear. Please rephrase/update question using 'Improve question' link.

Hi,

Your code will just concatenate the strings, it will not give sum.
Try:

C#
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 :)
 
Share this answer
 
Hello

Not a really clear question but:
If you want javascript in content page then:
call Page.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

C#
int number1 = 0;
int number2 = 0;
int number3 = 0;
int.TryParse(OSIInterstFromBank.Text, out number1);
int.TryParse(txtOSITDSFromBank.Text, out number2);
...
 
Share this answer
 
v4
Comments
Mohammad A Rahman 15-May-12 0:33am    
Good use of TryParse, my 5 :)
Shahin Khorshidnia 15-May-12 0:43am    
Thank you very much Mohammad.
Maciej Los 15-May-12 1:53am    
Good answer, my 5!
Shahin Khorshidnia 15-May-12 8:28am    
Thank you losmac :)
Sandeep Mewara 15-May-12 14:13pm    
Good answer. 5!
string + string = stringstring  SumOfStrings<br />
int + int + int = SumOf3int<br />
number + number = SumOf2numbers


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.
 
Share this answer
 
v3
Comments
Sandeep Mewara 15-May-12 14:12pm    
Well spotted. 5!
Maciej Los 15-May-12 14:19pm    
Thank you ;)
VJ Reddy 16-May-12 10:45am    
Good point. 5!
Maciej Los 16-May-12 10:58am    
Thank you, VJ ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900