473,657 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamicly add link button to calendar cel

I am trying to add a link button to a calendar.
this is a simple example:
Private Sub Calendar1_DayRe nder(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.DayR enderEventArgs) Handles Calendar1.DayRe nder
If e.Day.Date = Now.Date Then
Dim lbtntemp As New LinkButton
lbtntemp.Text = "go here"
lbtntemp.ID = "thsLnk"
e.Cell.Controls .Add((lbtntemp) )
End If
End Sub
3. issues
1. i do not have a link, only text
2. i want to pass parameter(s) withthe link
3. how can i add a <br> to the cell if i want to add multile items?

Thanks!!!
kes
Nov 19 '05 #1
4 4516
You should read the DayRender documentation:

Note 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.L iteralControl, Label, Image, and HyperLink.

I guess you're stuck with using a <a href=....> and pass something in the
querystring..
AS for your <br> question, try:

e.Cell.Controls .Add(New LiteralControl( "<br>"))

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Kurt Schroeder" <Ku***********@ discussions.mic rosoft.com> wrote in message
news:0E******** *************** ***********@mic rosoft.com...
I am trying to add a link button to a calendar.
this is a simple example:
Private Sub Calendar1_DayRe nder(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.DayR enderEventArgs) Handles Calendar1.DayRe nder
If e.Day.Date = Now.Date Then
Dim lbtntemp As New LinkButton
lbtntemp.Text = "go here"
lbtntemp.ID = "thsLnk"
e.Cell.Controls .Add((lbtntemp) )
End If
End Sub
3. issues
1. i do not have a link, only text
2. i want to pass parameter(s) withthe link
3. how can i add a <br> to the cell if i want to add multile items?

Thanks!!!
kes

Nov 19 '05 #2
What works for me is to set the SelectionMode Property to "Day." At this
point .Net automatically converts the day number as a linkbutton, which you
can use to capture which day the user selects!

To do that you use the calendar's SelectionChange d event to capture the
SelectedDate property:
(This is from MSDN under the SelectedDate property topic)
Label1.Text = "The selected date is " &
Calendar1.Selec tedDate.ToShort DateString()

Since you now have the date the user selected, you can do such things as
populate a datagrid with the different items that are on that day from a
database.

Hope this helps.
Richard
"Kurt Schroeder" wrote:
I am trying to add a link button to a calendar.
this is a simple example:
Private Sub Calendar1_DayRe nder(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.DayR enderEventArgs) Handles Calendar1.DayRe nder
If e.Day.Date = Now.Date Then
Dim lbtntemp As New LinkButton
lbtntemp.Text = "go here"
lbtntemp.ID = "thsLnk"
e.Cell.Controls .Add((lbtntemp) )
End If
End Sub
3. issues
1. i do not have a link, only text
2. i want to pass parameter(s) withthe link
3. how can i add a <br> to the cell if i want to add multile items?

Thanks!!!
kes

Nov 19 '05 #3
here is an odd one. I was able to add alink button and it can post back here
is how:
If e.Day.Date = Now.Date Then

Dim lbtntemp As New LinkButton
lbtntemp.Text = "go here"
lbtntemp.ID = "thsLnk"
lbtntemp.Comman dName = "ths One"
lbtntemp.Comman dArgument = "1"
lbtntemp.Attrib utes("onClick") =
"javascript:__d oPostBack('Link Button1','2day' )"

e.Cell.Controls .Add(lbtntemp)
Dim btnbx1 As New Button
btnbx1.ID = "mytxt"
btnbx1.Text = "go"
btnbx1.CommandA rgument = "ths" & Now.Date
btnbx1.CommandN ame = "ok_GO"

e.Cell.Controls .Add(btnbx1)
' DataBind()

End If
the link did work. The button did also, but not the way i wanted. I'm still
working onthis do you want me, but made some progress.
do you want me to keep you posted?
thanks
kes
"Karl Seguin" wrote:
You should read the DayRender documentation:

Note 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.L iteralControl, Label, Image, and HyperLink.

I guess you're stuck with using a <a href=....> and pass something in the
querystring..
AS for your <br> question, try:

e.Cell.Controls .Add(New LiteralControl( "<br>"))

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Kurt Schroeder" <Ku***********@ discussions.mic rosoft.com> wrote in message
news:0E******** *************** ***********@mic rosoft.com...
I am trying to add a link button to a calendar.
this is a simple example:
Private Sub Calendar1_DayRe nder(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.DayR enderEventArgs) Handles Calendar1.DayRe nder
If e.Day.Date = Now.Date Then
Dim lbtntemp As New LinkButton
lbtntemp.Text = "go here"
lbtntemp.ID = "thsLnk"
e.Cell.Controls .Add((lbtntemp) )
End If
End Sub
3. issues
1. i do not have a link, only text
2. i want to pass parameter(s) withthe link
3. how can i add a <br> to the cell if i want to add multile items?

Thanks!!!
kes


Nov 19 '05 #4
Kurt:
Posting updates is always helpful to others who run into the same problems
you do. It's a shame you need to go through that extra effort, but does
seem like the only way to get things going. You might benefit from using a
3rd party control other than the built-in calendar.

I've always liked the free EwolrdUI one:
http://www.eworldui.net/CustomContro...PopupDemo.aspx

though I don't know if it'll solve your problem any better...

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Kurt Schroeder" <Ku***********@ discussions.mic rosoft.com> wrote in message
news:69******** *************** ***********@mic rosoft.com...
here is an odd one. I was able to add alink button and it can post back
here
is how:
If e.Day.Date = Now.Date Then

Dim lbtntemp As New LinkButton
lbtntemp.Text = "go here"
lbtntemp.ID = "thsLnk"
lbtntemp.Comman dName = "ths One"
lbtntemp.Comman dArgument = "1"
lbtntemp.Attrib utes("onClick") =
"javascript:__d oPostBack('Link Button1','2day' )"

e.Cell.Controls .Add(lbtntemp)
Dim btnbx1 As New Button
btnbx1.ID = "mytxt"
btnbx1.Text = "go"
btnbx1.CommandA rgument = "ths" & Now.Date
btnbx1.CommandN ame = "ok_GO"

e.Cell.Controls .Add(btnbx1)
' DataBind()

End If
the link did work. The button did also, but not the way i wanted. I'm
still
working onthis do you want me, but made some progress.
do you want me to keep you posted?
thanks
kes
"Karl Seguin" wrote:
You should read the DayRender documentation:

Note 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.L iteralControl, Label, Image, and HyperLink.

I guess you're stuck with using a <a href=....> and pass something in the
querystring..
AS for your <br> question, try:

e.Cell.Controls .Add(New LiteralControl( "<br>"))

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Kurt Schroeder" <Ku***********@ discussions.mic rosoft.com> wrote in
message
news:0E******** *************** ***********@mic rosoft.com...
>I am trying to add a link button to a calendar.
> this is a simple example:
> Private Sub Calendar1_DayRe nder(ByVal sender As Object, ByVal e As
> System.Web.UI.W ebControls.DayR enderEventArgs) Handles
> Calendar1.DayRe nder
> If e.Day.Date = Now.Date Then
> Dim lbtntemp As New LinkButton
> lbtntemp.Text = "go here"
> lbtntemp.ID = "thsLnk"
> e.Cell.Controls .Add((lbtntemp) )
> End If
> End Sub
> 3. issues
> 1. i do not have a link, only text
> 2. i want to pass parameter(s) withthe link
> 3. how can i add a <br> to the cell if i want to add multile items?
>
> Thanks!!!
> kes


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4069
by: Aymer | last post by:
i created a new button object. how do i attach an event on it? thanx for your help. Dim cc As ColorConverter = new ColorConverter() Dim b = new button() b.ID = "SelectedDate" b.BorderStyle = 1 b.forecolor = cc.ConvertFromString("red") b.BackColor = cc.ConvertFromString("white")
8
5097
by: timmy_dale12 | last post by:
I need help with this one. I have a function that pastes a row. In each row i am pasting a link which is to call a date picker javascript function. This is the code that pastes the link : link = document.createElement('a'); link.href ="javascript:show_calendar('document.form1.date',document.form1.date.value);"; img = document.createElement('img'); img.setAttribute("src","H:Diverse\\cal.gif"); link.appendChild(img);
1
1794
by: Henke | last post by:
Hi I have a aspx-page with a panel-control. On this panel control I add user controls dynamicly with LoadControl and panel.Controls.Add(myControl). On some of the dynamicly added user controls I have button's and handlers for the click event. Why doesn't the event get fired in the dynamicly added control? Thanks!
2
2007
by: DaWoE | last post by:
Hi all, I'm fairly new to ASP.NET. What i want to do is creat a online registration form. On the first step is getting the users details and the number of people he wants to register. Based on the number of people i want to create a form where he can enter the persons details. For example he wants to register 3 people. Then the second step of the registration would have to be like this :
0
977
by: Peer K | last post by:
Hello, This is driving me nuts! It's a bit hard to explain so please bare with me. I have an ASP.NET page that uses the calendar control. I use DayRender to set specific days selectable depending on data in a database. Works fine. I want to be able to give a user a direct link that shows content for a specified date - AND sets the calendar control to that date. I've done this by making a direct link in the form...
1
1462
by: federicog | last post by:
I'm using this calendar: http://www.dynarch.com/projects/calendar/. I have three calendars on a page, and I need to "link" them together so that if I select a month in one calendar, the two following months are selected in the other two, so that you always get three correlative months in the calendars. Is that possible somehow? Also, I need to add a new row at the end of the calendar with an "OK" button to close the calendar, how can I...
4
1240
by: yogarajan | last post by:
hi All my form contains lot of text box and 2 button one button is submit button and another one is calendar button when i am click this calendar button calendar is shown. i am creating required field validation for all fields . but this time am click calender show button calendar doesnot shown, but validation control work (ie * keys shown) how can i solve this problem 1.when i am click submit button that times only validation control...
4
4576
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
0
8403
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8316
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.