Newbie: Calendar question?

J

JM

Hi,

I am new to asp.net, I need to show the calendar control with some days that
can be picked by the user and other days that cannot. Please is there any
property that allow me to "disabled" one specific day so it can not be
picked?, Is there any property that allow me to "disabled" and entire month,
so I can show up the month but the user can not picked up any day?.

Thanks,

Jaiem
 
A

andrew

I had the same problem, Basically i needed to make a calendar control
that a user could picks dates from but i only wanted the users to be
able to pick dates that were valid pay days. You can handle the
calendar dayRender function. Here is a short example of how i did
this.
Public Sub calDatePicker_DayRender(ByVal sender As System.Object, ByVal
e As System.Web.UI.WebControls.DayRenderEventArgs) Handles
calDatePicker.DayRender

Dim Link As HtmlGenericControl = New HtmlGenericControl

' Clear the link from this day
e.Cell.Controls.Clear()

' Add the custom javascript link
Link.InnerText = e.Day.DayNumberText

If GlobalFunctions.IsPayDay(e.Day.Date) Then
Link.TagName = "a"
Link.Attributes.Add("href",
"javascript:window.opener.document.getElementById('" &
Request.QueryString("field") & "').value = '" & e.Day.Date & "';
window.close();")
e.Day.IsSelectable = True
Else
e.Day.IsSelectable = False
End If


' Highlight today's date
If (e.Day.IsSelected) Then
Link.Attributes.Add("style",
calDatePicker.SelectedDayStyle.ToString())
End If

If Not e.Day.IsOtherMonth Then
' Add customer link to calendar picker page
e.Cell.Controls.Add(Link)
Else
e.Cell.Text = ""
End If

End Sub

Good luck, let me know if you have any other questions.
Cheers,
Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top