Click here to Skip to main content
Sign Up to vote bad
good
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:24


1 solution

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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 425
1 OriginalGriff 315
2 Slacker007 240
3 Aarti Meswania 210
4 Maciej Los 200
0 Sergey Alexandrovich Kryukov 8,953
1 OriginalGriff 7,134
2 CPallini 3,758
3 Rohan Leuva 3,036
4 Maciej Los 2,488


Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid