Showing posts with label txtbox2. Show all posts
Showing posts with label txtbox2. Show all posts

Wednesday, March 21, 2012

populate txtbox

I need to populate a txtbox using client side code. In txtbox1 I let the user select a date and I want to populate txtbox2. I want to do this on the client side, so txtbox2 is automatically populated without having to post back the page. This is how I was thinking about doing it. In the onTextChanged event in txtbox1, I'll call a javascript procedure to place this value in txtbox2...

txtbox2 = DateAdd(DateInterval.Day, 1, CDate(txtbox1.Text))

Is this the proper way to do this? Does anyone have an example?

thanks,
eyeI've used javascript but I normally find some code examples that I can adapt so I can't remember the exacxt way to do what you want. If you look at some javascript sites you should find it easily enough.

Friday, March 16, 2012

populating a txtbox

I have two txtboxs. Txtbox1 I let the user populate with a date then I want to populate txtbox2 with a date that is 7 days later. I'm using this code in my codebehind page to populate txtbox2, which is working fine.

txtbox2.Text = DateAdd(DateInterval.Day, 7, CDate(txtbox1.Text))

What I want to know, is there a way to have txtbox2 populate as soon as txtbox1 is filled without having to call the page, so the user knows they won't have to fill in the second date?

thanks,
eyeYou will have to use javascript to do it.