Rank: Newbie Groups: Member
Joined: 7/29/2008 Posts: 1
|
I'm having an issue with the datepicker and this is how the scenario is set. I'm developing in VS 2008 and using C# as my server side code. Now the problem is:
I created a page that a user will be able to add users into a SQL Server database. The user will enter the user name, password, first name, last name, user type and the date joined. Once this information is filled in the user then clicks an image button to query the database ( using a sqldatasource ) to query to see if the user name already exists. If the user name does not exist, it then inserts the record into the database.
Now in my image button click event, before I run the select statement of the sqldatasource I check to make sure all the required fields are filled in, including the joined date. I have noticed that when i add users to the page the date always gets set to today's date even if the user changes the date with the datepicker. In my loading of the page event i do have:
if( !Page.IsPostBack ) dpJoinedDate.SelectedDate = DateTime.Today;
The only other time i change the SelectedDate of my datepicker is after a record is inserted, it then defaults to todays date again.
Any idea why the datepicker is not registering the selected date the user is choosing? Does postback affect the selected value of the datepicker?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
Thanks for posting in the forum, however we are not ware of any issue like this. The best way we can recommend is to try it out in a separate page. You can create a blank page, put the DatePicker in, and then try to duplicate the logic of the page that you are having problem with. Instead of writing the date into your database, you can use a Label to display the DatePicker value. That way it should help you find out where it breaks down.
If the problem still occurs in the test page, please post the test page. Make sure the page runs independently and we will be happy to take a look.
Thanks
|