Home All Groups Group Topic Archive Search About
Author
14 Jul 2006 6:16 AM
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

Author
14 Jul 2006 9:02 PM
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

JM wrote:
Show quoteHide quote
> 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