I am a new user trying to follow along with the RadScheduler webinar introduction. I have everything set up to the point of database binding. I am following through the examples, set up the connections to the sql server, edited the connections, but when I get as far as binding the radscheduler to the BindingSource, the RadScheduler is invisible during runtime (however if you right click where it is supposed to be you still get a "New Appointment" menu. It seems that all off the hard coded resources and all the properties set upon form load are not taking effect to the radscheduler ONLY if I am using the smart tag to bind the bindingSource.
Any ideas of what I may be overlooking?
Thanks!
10 Answers, 1 is accepted
Private Sub RadForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'AppointmentsDataSet.Appointments' table. You can move, or remove it, as needed.
'Me.AppointmentsTableAdapter.Fill(Me.AppointmentsDataSet.Appointments)
Dim colors() As Color = {Color.LightBlue, Color.LightGreen, Color.LightYellow, Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue}
Dim names() As String = {"Joseph Regan", "Anne Dodsworth", "Boyan Mastoni", "Richard Duncan", "Maria Shnaider", "Carmen Louis"}
For i As Integer = 0 To names.Length - 1
Dim resource As New Resource()
resource.Id =
New EventId(i)
resource.Name = names(i)
resource.Color = colors(i)
'resource.Image = Me.imageList1.Images(i)
Me.RadScheduler1.Resources.Add(resource)
Next i
RadScheduler1.HeaderFormat =
"dddd MMMM dd, yyyy"
RadScheduler1.GetDayView().DayCount = 1
RadScheduler1.ActiveView.ResourcesPerView = 5
RadScheduler1.GroupType = GroupType.Resource
Dim appointmentsAdapter As New AppointmentsDataSetTableAdapters.AppointmentsTableAdapter()
appointmentsAdapter.Fill(AppointmentsDataSet.Appointments)
Dim resourcesAdapter As New AppointmentsDataSetTableAdapters.ResourcesTableAdapter()
resourcesAdapter.Fill(AppointmentsDataSet.Resources)
Dim appointmentsResourceAdapter As New AppointmentsDataSetTableAdapters.AppointmentsResourcesTableAdapter()
appointmentsResourceAdapter.Fill(AppointmentsDataSet.AppointmentsResources)
RadCalendar1.AllowMultipleView =
True
RadCalendar1.MultiViewRows = 3
End Sub
Private Sub RadScheduler1_ActiveViewChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.SchedulerViewChangedEventArgs)
RadScheduler1.ActiveView.ResourcesPerView = 5
End Sub
Private Sub RadCalendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadCalendar1.SelectionChanged
RadScheduler1.ActiveView.StartDate = RadCalendar1.SelectedDate
End Sub
Private Sub AppointmentsDataSetBindingSource_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AppointmentsDataSetBindingSource.CurrentChanged
End Sub
Private Sub RadButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton1.Click
Dim appointmentTableAdapter As New AppointmentsDataSetTableAdapters.AppointmentsTableAdapter()
Dim appointmentResourcesTableAdapter As New AppointmentsDataSetTableAdapters.AppointmentsResourcesTableAdapter()
Dim deletedChildRecords As AppointmentsDataSet.AppointmentsResourcesDataTable = Me.AppointmentsDataSet.AppointmentsResources.GetChanges(DataRowState.Deleted)
Dim newChildRecords As AppointmentsDataSet.AppointmentsResourcesDataTable = Me.AppointmentsDataSet.AppointmentsResources.GetChanges(DataRowState.Added)
Dim modifiedChildRecords As AppointmentsDataSet.AppointmentsResourcesDataTable = Me.AppointmentsDataSet.AppointmentsResources.GetChanges(DataRowState.Modified)
Try
If deletedChildRecords IsNot Nothing Then
appointmentResourcesTableAdapter.Update(deletedChildRecords)
End If
appointmentTableAdapter.Update(AppointmentsDataSet.Appointments)
If newChildRecords IsNot Nothing Then
appointmentResourcesTableAdapter.Update(newChildRecords)
End If
If modifiedChildRecords IsNot Nothing Then
appointmentResourcesTableAdapter.Update(modifiedChildRecords)
End If
AppointmentsDataSet.AcceptChanges()
Catch ex As Exception
Throw ex
Finally
If deletedChildRecords IsNot Nothing Then
deletedChildRecords.Dispose()
End If
If newChildRecords IsNot Nothing Then
newChildRecords.Dispose()
End If
If modifiedChildRecords IsNot Nothing Then
modifiedChildRecords.Dispose()
End If
End Try
End Sub
Unfortunatly I haven't been able to replicate your issue. I was wondering if this may be an issue with the data source. Please could you try something for me? Take your code, and add it to a new project, but leave out the
Dim
appointmentsAdapter
As
New
AppointmentsDataSetTableAdapters.AppointmentsTableAdapter()
appointmentsAdapter.Fill(AppointmentsDataSet.Appointments)
Dim
resourcesAdapter
As
New
AppointmentsDataSetTableAdapters.ResourcesTableAdapter()
resourcesAdapter.Fill(AppointmentsDataSet.Resources)
Dim
appointmentsResourceAdapter
As
New
AppointmentsDataSetTableAdapters.AppointmentsResourcesTableAdapter()
appointmentsResourceAdapter.Fill(AppointmentsDataSet.AppointmentsResources)
Let me know if you can then see your scheduler correctly. If this does work, what happens when you add back in the data source?
Look forward to hearing back from you
Richard
Thank you for writing.
You can find the answer to your question in the other thread that you have created about the same topic.
Greetings,
Dobry Zranchev
the Telerik team
Sorry it took long to get back to you, my HDD crashed and I had to redo everything!
Yes, when I take out that code, the scheduler has reappeared again.
The second I click "Save" button, the scheduler disappears again, ALTHOUGH IT DOES SEEM TO SAVE! So perhaps that code you told me to take out is incorrect?
I have isolated the problematic code:
Dim resourcesAdapter As New SchedulerDataSetTableAdapters.ResourcesTableAdapter()
resourcesAdapter.Fill(SchedulerDataSet.Resources)
When these two lines are commented out, the scheduler does appear, but does not show appointments in schedule (does seem to write to schedule -- but then the scheduler disappears!) Attached is a screenshot of database map. Thanks
Thanks again!
The response from Telerik in this thread says that you have an answer in a support ticket. Has this not solved it for you?
If not, I would suggest reconfiguring your datasource.
Regards,
Richard
I basically have the same problem if I remove the connection to the datasource the scheduler displays perfectly but with the data connection (which is populated with data) the calendar seems to "truncate" for lack of better term. Any help would be greatly appreciated as I have looked at all examples and forum posts.. Code follows:
DateTime dtStart = GetMonday(DateTime.Now);
sMain.ActiveView.StartDate = dtStart;
AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo();
ResourceMappingInfo rmi = new ResourceMappingInfo();
SchedulerBindingDataSource sbDataSource = new SchedulerBindingDataSource();
string strSQL = @"SELECT
ooo.id,
CONVERT(DATETIME,ooo.dateBegin,108) + ' 12:00:00' dateBegin,
CONVERT(DATETIME,ooo.dateEnd,108) + ' 23:59:59' dateEnd,
u.fname + LEFT(u.lName,1) + '.' agentName,
ISNULL(ooo.msgOutOfOffice,'Out of Office') msgOutOfOffice,
st.scheduleType,
st.colorCode,
st.id stID
FROM
users.outOfOffice ooo
INNER JOIN users u on ooo.agentId = u.phoneAgentId
INNER JOIN oooScheduleTypes st ON ooo.scheduleType = st.id
WHERE
ooo.agentID IS NOT NULL
AND ooo.dateBegin BETWEEN CONVERT(NVARCHAR(10),'" + dtStart.ToString() + "',112) AND CONVERT(NVARCHAR(10),'" + sMain.ActiveView.EndDate.ToString() + "',112)";
using (DataTable dtData = GetDataTable(strSQL))
{
appointmentMappingInfo.UniqueId = "id";
appointmentMappingInfo.Start = "dateBegin";
appointmentMappingInfo.End = "dateEnd";
appointmentMappingInfo.Summary = "agentName";
appointmentMappingInfo.Description = "msgOutOfOffice";
appointmentMappingInfo.Location = "scheduleType";
appointmentMappingInfo.Visible = "Visible";
sbDataSource.EventProvider.Mapping = appointmentMappingInfo;
sbDataSource.EventProvider.DataSource = dtData;
rmi.Id = "stID";
rmi.Name = "scheduleType";
sbDataSource.EventProvider.Mapping = rmi;
sbDataSource.EventProvider.DataSource = dtData;
}
sMain.DataSource = sbDataSource;
Thank you for writing.
I have tested binding RadScheduler to my SQL server and it seems to work as expected with the latest version. I have attached a sample project for your reference. I have included a backup file of my database as well. Could you please specify the exact steps how to reproduce the problem with the project? Otherwise, feel free to submit a support ticket where you can provide a runnable sample project demonstrating the problem. Thus, we would be able to make an adequate analysis of the problem and assist you further. Thank you in advance.
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Progress Telerik
Hi Dess,
You guys are always amazingly quick at responding back -- thank you.... I am not having any luck running the sample application as I am getting the attached error -- I am running VS2017 with version 2017.2.613.40 of the Telerik controls -- any caveats there? I was hoping to see the one line of code that would lead me to my error but I do not see it.. I am also attaching a screenshot of what the app looks like with and without the dataset attached.
--Corey--
Thank you for writing back.
In order to run the sample project, it is necessary to use the backup file of my sample SQL database and restore it to your local SQL server. Then, it is necessary to change the connection string in the App.config file. The following threads are quite useful how to restore from a .bak file:
https://stackoverflow.com/questions/1535914/import-bak-file-to-a-database-in-sql-server
https://msdn.microsoft.com/en-us/library/ms177429(v=sql.90).aspx
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik