Welcome Guest Search | Active Topics | Sign In | Register

how to set the calendar default date to the client's PC date Options
mckulap
Posted: Wednesday, July 30, 2014 9:18:03 PM
Rank: Advanced Member
Groups: Member

Joined: 9/18/2007
Posts: 38
the question is in the title

I can set the calendar (actually datepicker) date to the clients date easily after the page is posted back once, but to do it on page load is really causing me some head banging

been running variants of this command client side (in javascript)

eo_GetObject(<% = calday.ClientID %>).setSelectedDate(new Date());

where calday is the server ID of the object

the issue seems to be that the control doesn't exist during the initial page load - have tried all kinds of stuff even calling it from the clientsideonload property but I always get an error basically saying the control doesn't exist yet. Like I said if I replicate the code on a postback it works fine, but I need to set this value when the page loads

help would be appreciated

eo_support
Posted: Thursday, July 31, 2014 10:16:42 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Please try to handle the Calendar's ClientSideOnLoad event and then set it inside that event handler. It will be something like this:

Code: HTML/ASPX
<eo:Calendar .... ClientSideOnLoad="calendar_on_load" ...>
    ....
</eo:Calendar>


Code: JavaScript
function calendar_on_load()
{
    eo_GetObject(<% = calday.ClientID %>).setSelectedDate(new Date());  
}


Please let us know if this works for you.

Thanks!
mckulap
Posted: Thursday, July 31, 2014 10:57:50 AM
Rank: Advanced Member
Groups: Member

Joined: 9/18/2007
Posts: 38
as I mentioned in my original post - I did try this method and I still get an error saying the object passed to eo_GetObject is null - in essence the calday control doesn't yet exist

any other help would be appreciated
eo_support
Posted: Thursday, July 31, 2014 4:50:33 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Sorry that I missed that you have already tried ClientOnLoad. ClientOnLoad should work because it is only fired after the Calendar has been loaded. If that still does not work, please try to isolate the problem into a test page and we will be happy to take a look.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.