Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ASP Calendar - cell "OnClick" event

Reply
Thread Tools

ASP Calendar - cell "OnClick" event

 
 
wwcoop
Guest
Posts: n/a
 
      09-24-2005
The calendar control allows the user to select a date by clicking
on the day number in the cell. I would like to extend
this functionality so that the use can click anywhere in a calendar
cell to trigger the selectionchanged event. I would like to assign
an "OnClick" event to the calendar cell in the OnDayRender sub.
How can I achieve the desired result?
--
Will Cooper
MCSD .NET
 
Reply With Quote
 
 
 
 
wwcoop
Guest
Posts: n/a
 
      09-26-2005
Thanks, you put me on the right path. Here is the solution:
******************************************
Dim d as CalendarDay
Dim c as TableCell
Dim datOrigin as Date = "1-1-2000"
Dim strDay as String

d = e.Day
c = e.Cell

strDay = CStr(DateDiff("d", datOrigin, d.date))

.....

c.Attributes.Add("OnClick", "javascript:__doPostBack('ca','" & strDay &
"')")
******************************************
--
Will Cooper
Application Programmer


"Peter Blum" wrote:

> Hi Will,
>
> Here's a thought. The OnDayRender method is passed a TableCell control,
> where you populate it with other controls. In this case, you want to add the
> onclick event directly to the TableCell. The code for this is a post back,
> which you use the Page.GetPostBackEventReference() method to generate the
> right code. The trick is to generate the same elements in
> GetPostBackEventReference() that the hyperlink on the day number does. That
> takes some review of the HTML output to see what they do.
>
> cell.Attributes.Add("onclick", Page.GetPostBackEventReference(cell, "???",
> "???"))
>
> Another approach is to replace the ASP.NET calendar with one built by a
> third party that does not require post back. These calendars use javascript
> and usually handle the onclick event on a day cell for you. Mine, the
> CS_Calendar control inside of "Peter's Date Package"
> (http://www.peterblum.com/datecontrols/home.aspx), can still optionally post
> back. By using javascript, even if you elect to post back on each selection
> change, you don't need to post back as the user changes months.
>
> You will find other third party calendars at the www.asp.net control
> gallery, www.411asp.net, and www.123aspx.com.
>
> --- Peter Blum
> www.PeterBlum.com
> Email: http://www.velocityreviews.com/forums/(E-Mail Removed)
> Creator of "Professional Validation And More" at
> http://www.peterblum.com/vam/home.aspx
>
> "wwcoop" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > The calendar control allows the user to select a date by clicking
> > on the day number in the cell. I would like to extend
> > this functionality so that the use can click anywhere in a calendar
> > cell to trigger the selectionchanged event. I would like to assign
> > an "OnClick" event to the calendar cell in the OnDayRender sub.
> > How can I achieve the desired result?
> > --
> > Will Cooper
> > MCSD .NET

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar GadGets does not show calendar iccsi Windows 64bit 4 08-14-2011 01:52 PM
How to Synchronise Hotmail Calendar with Standard Outlook Calendar using Outlook Connector ?? Synapse Syndrome Computer Support 0 12-02-2007 04:19 AM
Changing the color of cell on mouse over event in calendar control Garg ASP .Net Web Controls 1 03-19-2007 07:40 AM
Thunderbird Calendar with Exchange 2003 Calendar and Public FoldersCalendar jincmcse Firefox 1 09-03-2005 02:46 AM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net 3 06-23-2004 01:41 PM



Advertisments