I’m using GM Date Picker.. My code is as follows:
<cc1:GMDatePicker ID="DatePicker" AutoPosition="false" runat="server" CalendarTheme="Blue"
Style="z-index: 252; left: 0px; position: absolute; top: 0px" DateFormat="dd/MM/yyyy"
TodayButtonText="">
I’ve given the Date Format as mentioned above. But, it not taking in that format. It is taking only in this format MM/dd/YYYY. When I’m saving, it is taking the current date.. If i give in MM/dd/YYYY format, it is taking the correct date value..
How to overcome this problem?
this control has a bug in the Date property get method, whenever date is read from the textbox the date format value is not taken into account. Here’s an exact line of the Date property get method which throws an exception:
the reason why you’re getting a current date is that control caches all exceptions are returns current date in case one is occurred.
So what do you do, besides finding another control or asking vendor to fix this one. The workaround would be to get the date directly from control’s textbox without using its Date property via reflection and parse it. Below is an example of how you can do this:
hope this helps, regards