Newbie: Calendar question?

Discussion in 'ASP .Net Web Controls' started by JM, Jul 14, 2006.

  1. JM

    JM Guest

    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
    JM, Jul 14, 2006
    #1
    1. Advertising

  2. JM

    andrew Guest

    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:
    > 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
    andrew, Jul 14, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hanschao
    Replies:
    0
    Views:
    371
    hanschao
    Feb 26, 2004
  2. Shevek
    Replies:
    3
    Views:
    6,012
    Shevek
    Jun 23, 2004
  3. Shevek
    Replies:
    0
    Views:
    374
    Shevek
    Jun 23, 2004
  4. Parthiv Joshi
    Replies:
    1
    Views:
    646
    Samuel L Matzen
    Jul 6, 2004
  5. Jerry C.
    Replies:
    8
    Views:
    214
    Uri Guttman
    Nov 23, 2003
Loading...

Share This Page