Connecting Tech Pros Worldwide Forums | Help | Site Map

Text Box Events

Member
 
Join Date: Feb 2008
Posts: 75
#1: Sep 26 '09
Guys,

I am new to Programming in ASP.net using C#.

I have 2 numeric values in 2 text box and i am asked to display the addition value in the third box. I have writing the following code in the text change () of the second box
Expand|Select|Wrap|Line Numbers
  1.         int InINR;
  2.         int ExghRt;
  3.         int FC;
  4.  
  5.         ExghRt = Convert.ToInt32(txtExchRate.Text);
  6.         FC = Convert.ToInt32(txtFC.Text);
  7.        InINR = FC * ExghRt;
  8.         txtInINR.Text = Convert.ToString(InINR);
This works only when i press the enter key. What i want is that the moment the value is entered in the second text box, the user presses the tab key, the result is displayed in the third text box.

can anyone suggest on which event do i write this code.

Thanks / Sajit

ssnaik84's Avatar
Member
 
Join Date: Aug 2009
Location: Bengaluru, India
Posts: 122
#2: Sep 26 '09

re: Text Box Events


you dont need server side programming for this. just use javascript.
write a javascript function for addition and call at "onblur" attribute in your second text box.
Expand|Select|Wrap|Line Numbers
  1.  onblur="javascript:addition();"
Reply