On my web page I have a Scheduler and a dropdown. I need to rebind a new set of data to the scheduler on the dropdown SelectedIndexChanged event based on selected value from the dropdown list. My scheduler works fine when I bind the datatable to scheduler on the page_load event for the first time. But when I rebind the new set of data on dropdown SelectedIndexChanged event, the scheduler is empty; though I have 100s of records exists in the new datatable. Is it happening because I am missing something?.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CounselorName()
End If
RadScheduler1.DataSource = getAppointments
End Sub
Private ReadOnly Property getAppointments() As DataTable
Get
Dim dt As DataTable = CType(Session(AppointmentsKey), DataTable)
If dt Is Nothing Then
dt = CreateDataTable()
Session(AppointmentsKey) = dt
End If
Return dt
End Get
End Property
Private Function CreateDataTable() As DataTable
Dim dt As New DataTable
Dim repAppt As New _APPT()
repAppt.LoadApptsbyRepID(RepId)
dt = repAppt.DefaultView.Table
Return dt
End Function
Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim schedule As New _APPT()
Dim item As String = Me.ListBox1.SelectedItem.Text()
RepId = Me.ListBox1.SelectedValue()
Session(AppointmentsKey) = Nothing
RadScheduler1.DataSource = getAppointments
End Sub