Solved

custom datetimepicker date on another tab page not shown correctly

Posted on 2008-10-30
3
593 Views
Last Modified: 2012-05-05
I have created a custom datetimepicker control - basically to make the presentation better when having no date set as well as a couple of other considerations.  This control works beautifully IF THE CONTROL IS IN VIEW/DISPLAYED/VISIBLE TO THE USER.
If I try to change its value (DTP1.Value = "8/3/2008") with the control not displayed (eg if DTP1 is on another tab page and not currently shown) then its OLD VALUE IS BEING DISPLAYED when I return to the control.  (On further testing, it turns out the .Value of the control IS the correct value ("8/3/2008 in this example) but the displayed value is not correct.)
Of course, I can write a crazy hack which temporarily shows the DTP control whilst I change its value, but that is soooo messy -- there must be a way to force my custom DTP control to show the new date value even though it is not currently in view.
Thanks in advance...
0
Comment
Question by:Sigh_Man
  • 2
3 Comments
 
LVL 14

Assisted Solution

by:jake072
jake072 earned 50 total points
ID: 22926059
Have you tried doing a .Refresh after you set the value?

Jake
0
 
LVL 1

Author Comment

by:Sigh_Man
ID: 22981963
Hi there
Sorry for the delay.  I tried .Refresh.  I tried everything I could think of like Invalidating the control (to force redraw) but nothing seems to work.
After some reading on the net, I discovered that this is a bug in the framework 2.0.  Custom format datetimepickers do not change their displayed date if they are contained within a tab page if their value is set whilst their owning tab page is not visible.
Of course, I wrote a disgusting hack which momentarily "selects" the relevant tab page whilst the DTP's value is set and then reverts to the original tab page again afterwards.  The result however is a screen flifker whilst the tab page selection changes - compounded by the fact that I have several tab pages in the same control so I have to iterate through each.  Not pleasant, and I will be re-working this solution before clients get it!  :D
0
 
LVL 1

Accepted Solution

by:
Sigh_Man earned 0 total points
ID: 22983057
Sorry I cannot locate the webpages where I saw this issue mentioned.  Basically, the fix is:
DON'T USE CUSTOM FORMATS IN YOUR DATETIMEPICKERS IF those DateTimePickers are located on tab pages and those DTPs are to have their values changed whilst their 'owner' tab page is not visible at the time of the Value Change.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now