Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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'
 
Share this answer
 

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