Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascipt call when date is clicked on calendar?

Status
Not open for further replies.

drew10

Programmer
Feb 26, 2002
123
US
I have a calendar control on my app. When a date is clicked, I would like to open a popup window that displays information about events for that date.

How do I make the javascript call when a date is clicked?

Thanks,
drew10
 
That's a tough one. I'm not really sure if that's even possible to wire your own client side events to the various clicks of the calendar, as that control (and its creation/rendering) is completely abstracted into the calendar control (as opposed to something like a datagrid or others).

However, an alternative may be to go ahead and handle the click event as you normally would, and in that event in your code-behind, write out some client side script to the browser that would display this alert. Yea, the page is going to flicker (post back), but I don't see how else you could accomplish this...

paul
penny1.gif
penny1.gif
 
Here's how I did it...

1. Create a Panel object which has the Javascript to popup the window.

2. Set the panel's Visible property to false.

3. Set the calendar's OnSelectionChanged property to a public/protected method of the Page.

4. In that method, set the panel's Visible property to true - this will force the Javascript to execute when the page loads. In order to pass parameters, you may need to create a TextBox and store the date as a temporary value. Do not set the TextBox's Visible property to false because it will not be on the form. You will have to create a <div style=&quot;display:none;&quot;> block to place teh TextBox into - or something similar.

Hope this works. This was sort of the same work-around I had to use. The only other alternative that I saw was creating a new calendar control that inherits the .NET one. ________________________________________
Michael C Flanakin
Indigo Web Systems
michael.flanakin@indigows.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top