By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,016 Members | 2,297 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,016 IT Pros & Developers. It's quick & easy.

Cant add events to HTML controls in a Calander control

P: n/a
Im not getting any error messages but the event is not going off when
i click the button it just posts back to the same page. I know this
code has worked outside of Calanders with the same code. Anyone have
any ideas?

While rdz.Read()
lb(rdz("id")) = New Button
lb(rdz("id")).ID = "lb" & rdz("id")
lb(rdz("id")).Text = rdz("lloyds_num")
AddHandler lb(rdz("id")).Click, AddressOf dayclickz
ctlCell.Controls.Add(lb(rdz("id")))
End While

<asp:Calendar OnDayRender="Calendar_RenderDay" id="myCal"
SelectionMode="None" Runat="server" />
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hello Michael,

Thanks very much for posting here.

Based on my understanding, now the question is: You added some controls to calendar control in DayRender event. Now
you wanted to know how to add event handlers to these added controls. Please let me know if I have misunderstood the
question.

Since the DayRender event is raised while the Calendar control is being rendered, you cannot add a control that can also
raise an event, such as LinkButton. You can only add static controls, such as System.Web.UI.LiteralControl, Label, Image,
and HyperLink. This is a limitation of Calendar control. This is documented in the Remarks section in the help of
Calendar.DayRender Event.

If you have any more concerns on it, please post here. Thanks.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: mc****@aol.com (Michael Evanchik)
!Newsgroups: microsoft.public.dotnet.framework.aspnet
!Subject: Cant add events to HTML controls in a Calander control
!Date: 29 Jul 2003 11:16:51 -0700
!Organization: http://groups.google.com/
!Lines: 15
!Message-ID: <73**************************@posting.google.com >
!NNTP-Posting-Host: 216.66.24.116
!Content-Type: text/plain; charset=ISO-8859-1
!Content-Transfer-Encoding: 8bit
!X-Trace: posting.google.com 1059502612 21298 127.0.0.1 (29 Jul 2003 18:16:52 GMT)
!X-Complaints-To: gr**********@google.com
!NNTP-Posting-Date: 29 Jul 2003 18:16:52 GMT
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!
news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!postnews1.google.com!not-for-mail
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163073
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!Im not getting any error messages but the event is not going off when
!i click the button it just posts back to the same page. I know this
!code has worked outside of Calanders with the same code. Anyone have
!any ideas?
!
! While rdz.Read()
! lb(rdz("id")) = New Button
! lb(rdz("id")).ID = "lb" & rdz("id")
! lb(rdz("id")).Text = rdz("lloyds_num")
! AddHandler lb(rdz("id")).Click, AddressOf dayclickz
! ctlCell.Controls.Add(lb(rdz("id")))
! End While
!
!<asp:Calendar OnDayRender="Calendar_RenderDay" id="myCal"
!SelectionMode="None" Runat="server" />
!
Nov 17 '05 #2

P: n/a
nope you hit on on the "button", unfortunate

Thanks
Nov 17 '05 #3

P: n/a
Hello Michael,

Please post here if you have any follow up questions.

Besides, regarding adding more functionality to calendars, try this:

Normally you have to click the text inside the cell. With this calendar you can click anywhere within the cell.

Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
e.Cell.Attributes.Item("onclick") = "javascript:__doPostBack('Calendar1','" & DateDiff(DateInterval.Day, #1/1/2000#,
e.Day.Date) & "');"
End Sub

Thanks.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: mc****@aol.com (Michael Evanchik)
!Newsgroups: microsoft.public.dotnet.framework.aspnet
!Subject: Re: Cant add events to HTML controls in a Calander control
!Date: 31 Jul 2003 08:35:14 -0700
!Organization: http://groups.google.com/
!Lines: 3
!Message-ID: <73**************************@posting.google.com >
!References: <73**************************@posting.google.com > <wY**************@cpmsftngxa06.phx.gbl>
!NNTP-Posting-Host: 24.44.204.68
!Content-Type: text/plain; charset=ISO-8859-1
!Content-Transfer-Encoding: 8bit
!X-Trace: posting.google.com 1059665715 23827 127.0.0.1 (31 Jul 2003 15:35:15 GMT)
!X-Complaints-To: gr**********@google.com
!NNTP-Posting-Date: 31 Jul 2003 15:35:15 GMT
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!
news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!postnews1.google.com!not-for-mail
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163809
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!nope you hit on on the "button", unfortunate
!
!Thanks
!
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.