This is a migrated thread and some comments may be shown as answers.

RadCalendar.. Selecting Dates... Server Side only

1 Answer 102 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Corey
Top achievements
Rank 1
Corey asked on 10 Sep 2009, 05:52 PM

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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Sep 2009, 07:54 AM
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
Tags
Calendar
Asked by
Corey
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or