Click here to Skip to main content
11,641,971 members (61,887 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET

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
Please Sign up or sign in to vote.

Solution 1

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


in .cs page
under pageload() you can add attribute as

this event will fire every time focus comes out of textbox 'box1'

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

  Print Answers RSS
0 DamithSL 268
1 OriginalGriff 150
2 Sergey Alexandrovich Kryukov 134
3 Mika Wendelius 130
4 Afzaal Ahmad Zeeshan 89
0 Mika Wendelius 460
1 OriginalGriff 265
2 DamithSL 258
3 CPallini 169
4 Afzaal Ahmad Zeeshan 149

Advertise | Privacy | Mobile
Web02 | 2.8.150731.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2015
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