Welcome Guest Search | Active Topics | Sign In | Register

Calendar - Scheduler return Options
TSI
Posted: Thursday, May 5, 2011 12:37:07 PM
Rank: Newbie
Groups: Member

Joined: 5/5/2011
Posts: 1
I have a Calendar object that I use the DayRender method to add a hyperlink for each item that occurs on that specific day. When I click the hyperlink the new page is displayed correctly, but here is where the problem comes in. Let say, for example, that the user navigates to October 2010 in the calendar and then click a link on one of the days. The new page is brought up with the calender items detail. If I then hit the back button the month showing in the calendar is no longer October 2010, it shows the actual current month (May 2011). How can I correct this?
eo_support
Posted: Thursday, May 5, 2011 1:53:52 PM
Rank: Administration
Groups: Administration

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

That will be a little bit complicated. :) There are several options.

Usually the browser automatically saves values of your input field when you navigate to a different page. The Calendar does not have an input field to associate with. So when you navigate away from the page nothing gets saved. What you can do is to add a hidden input field in the page, then modify your link code to do the following when user clicks it:

1. Save the clicked date in your hidden field;
2. Navigate to the new page;

You will also need to write code in your page to detect the value of your hidden field and if you see a value, then call the Calendar's client side JavaScript interface to scroll the Calendar to the correct month:

http://doc.essentialobjects.com/library/1/jsdoc.public.calendar.goto.aspx

If you have not used our client side JavaScript interface before, you will want to go over this topic first:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

An alternative is to let your link to do a post back, then do a redirect in your server side code redirect to the new page. This will work because upon post back, the Calendar would automatically save its state (including the current month) in view state. You will then be able to write code to retrieve this value and restore it later if the page is accessed again). If you use that approach, you will need to disable page caching to make sure every time the page is requested it does go to your server.

The client side approach is faster but it requires more code --- and it may not work reliably because different browser implements back button differently (for example, one browser may decide to discard "password" field, another browser may decide to "auto-fill" certain fields for you, all these "advanced features" can mess up your code logic). The server side approach on the other hand works more reliable because you are in complete control. This is also why financial websites almost never use the client side approach for this kind of scenarios.

Hope this helps. Please feel free to let us know if you have any more questions.

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.