Cant add events to HTML controls in a Calander control

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Cant add events to HTML controls in a Calander control

    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" />
    Michael Evanchik Guest

  2. Similar Questions and Discussions

    1. Embeding html controls in Server Control
      Hi Everyone, I have some HTML snippets (with about 15 HTML controls) that needs to be embedded into my server control. I need these HTML controls...
    2. Add controls to my custom control with tags in HTML design view
      I have created a custom control but would like to add other controls to it at design time. I want to be able to put custom control tags inside the...
    3. calander control
      where can i find a nice looking calander control to implement in an html page ? cheers
    4. Web User Control Events vs. Controls Content
      I have a textbox embedded in a DataGrid which in turn is part of a web user control. I want to save any changes made to the text on postback. This...
    5. Nesting server controls with a composite control don't generate postback events
      Hi, I am new to web controls so please forgive me if my terminology is not 100%! I am attempting to develop a composite control, based heavily...
  3. #2

    Default RE: Cant add events to HTML controls in a Calander control

    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! - [url]www.microsoft.com/security[/url]
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !From: [email]mcbain@aol.com[/email] (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: [url]http://groups.google.com/[/url]
    !Lines: 15
    !Message-ID: <73446b8b.0307291016.1cf44caa@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: [email]groups-abuse@google.com[/email]
    !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" />
    !


    Yan-Hong Huang[MSFT] Guest

  4. #3

    Default Re: Cant add events to HTML controls in a Calander control

    nope you hit on on the "button", unfortunate

    Thanks
    Michael Evanchik Guest

  5. #4

    Default Re: Cant add events to HTML controls in a Calander control

    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! - [url]www.microsoft.com/security[/url]
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !From: [email]mcbain@aol.com[/email] (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: [url]http://groups.google.com/[/url]
    !Lines: 3
    !Message-ID: <73446b8b.0307310735.6e124624@posting.google.com >
    !References: <73446b8b.0307291016.1cf44caa@posting.google.com > <wY7b#5zVDHA.2160@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: [email]groups-abuse@google.com[/email]
    !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
    !


    Yan-Hong Huang[MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139