In application I am working on I have a task: open new window from code behind code when user clicks in calendar.
This is very easy task and can be done with target="_blank" property of the link. But calendar is server control so if user click on some date there is a postback to server and page refershed. Postbacks is not very good for user experience and it was a lot of complains in previous version of application because users can't use back button and can't user refresh button...
But I found easy solution how to open new window from code behind code and avoid problems with postback.
Using update panel to open new window from codebehind in asp.net
If I put calendar in update panel, I still can use server events but it will be no page refresh for user.
Source code: How to open new window from codebehind file
This is calendar control. I use user control to wrap calendar code and put this control inside of UpdatePanel:
And this is code behind for opening new window:
Tips how to open new window from codebehind
UpdatePanel required ScriptManager, so do not forget to include it after the form tag.