How to assign a date value from a calendar popup to a hidden field

I have a search form with a couple of textboxes, dropdownlist controls and a Ajax calendar control. What I would like to do is to show, when picked a date from the calendar, this date in a label control in a ddd, MMM dd, yyyy format. Further I have a range validator to check if the picked date is in the future. If okay submit search form. My question is: can I store the picked date in a hidden field in short date format and manipulate this date to the above format and put this in a label control? I would like to use the hidden field value to query data when submitting the search from. I hope someone out there can help me how to tackle this. Many thanks in advance.

PdeLormeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James LooneySr. Programmer/AnalystCommented:
Which datepicker are you using? mootools? jquery? .... ?
0
PdeLormeAuthor Commented:
AJAX calendarextender control.
0
Piotr DCommented:
I don't know CalendarExtender, but, according to this page

http://www.koocow.com/blog/post/Ajax-CalendarExtender---Date-Validation.aspx

to get the current selected date, you should add OnClientDateSelectionChanged="updateHiddenField" attribute to your CalendarExtender control, place a hidden input in the form (e.g. <input type="hidden" id="myHiddenInput" />) and declare a javascript function:

function updateHiddenField(sender,args)
{
    document.getElementById("myHiddenInput").value = sender._selectedDate;
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.