RadCalendar.. Selecting Dates... Server Side only

2 posts, 0 answers
  1. Corey
    Corey avatar
    4 posts
    Member since:
    Jun 2009

    Posted 10 Sep 2009 Link to this post

    Situation.

    1.  I have a RadCalendar control on a simple web page.
    2.  I have a listbox control with dates in it (format dd/mm/yyyy)
    3.  On load i want to take the dates in the listbox and select them in the calendar.

    Constraints.. have to do this serverside (no java)

    I tried this in the ItemDatabound event of my listbox control

     

     

    Protected Sub elstDates_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles elstDates.DataBound

     

     

    For Each li As ListItem In elstDates.Items

     

    ecalDatesWorked.SelectedDate =

    CType(li.Value, Date).ToShortDateString

     

     

    Next

     

     

     

     

     

    End Sub

     


    li does have the values that i need (debugged this) and I am not getting any errors on the SelectedDate

    Help please

    Corey
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Sep 2009 Link to this post

    Hi Corey,

    Try the following code snippet in the PreRender event of the RadCalendar and see whether it works.

    VB:
     Protected Sub RadCalendar1_PreRender(ByVal sender As ObjectByVal e As EventArgs)  
        For Each item As ListItem In ListBox1.Items  
            Dim [date] As New RadDate(Convert.ToDateTime(item.Text))  
             RadCalendar1.SelectedDates.Add([date])  
         Next  
     End Sub  


    Thanks
    Shinu
Back to Top