Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hello,
 
I have two textboxes named box1 and box2 respt... box1 has a particular value say 100. I need to get that value to be displayed on box2 when I single click (mouse) on the box1.
 
I tried for text_changed event on box1 but it is not possible as we should enter some value in box1 and enter click.. But what i need is without writing anything in the box1, I need to get the data displayed from box1 to box2 on enter click or mouse click of box1.
Posted 27-Nov-12 0:24am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hi,
you can do that in textbox onblur event .
function in javascript
function copy(Box 1,Box2)
{
 
// var box1= document.getElementById(Box1).value;
// var box2 = document.getElementById(Box2).value;
// box2.value=box1;
//---------------------------------------------------
var box1= document.getElementById(Box1);
var box2 = document.getElementById(Box2);
box2.value=box1.value
 
}
 
in .cs page
under pageload() you can add attribute as
box1.Attributes.Add("onblur","copy('"+box1.ClientID+"','"+box2.ClientID+"')");
 
this event will fire every time focus comes out of textbox 'box1'
  Permalink  

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

  Print Answers RSS
0 Maciej Los 225
1 BillWoodruff 200
2 OriginalGriff 191
3 Kornfeld Eliyahu Peter 175
4 CPallini 164


Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100