I am new to Telerik controls and am attempting setting up a Scheduler control on a windows form. I have followed the web based sample and am attempting to bind to your sql based sample data using as the ScheduleBindingDataSource data setting the settings as your sample
Does the datasource need to be initiated when the form loads as I am returning no records?
ResourceProvide
Allownew True
Datamember Appointments
DataSource SchedulerDataDataSet
If I comment out the if statement in the data binding event and force a new instance of the SchedulerDataDataSet then the records are returned!
'If Me.SchedulerDataDataSet Is Nothing Then
Me.SchedulerDataDataSet = New SchedulerDataDataSet()
Dim appointmentsAdapter As New AppointmentsTableAdapter()
appointmentsAdapter.Fill(Me.SchedulerDataDataSet.Appointments)
Dim resourcesAdapter As New ResourcesTableAdapter()
resourcesAdapter.Fill(Me.SchedulerDataDataSet.Resources)
Dim appointmentsResourcesAdapter As New TransientAppointmentsResourcesTableAdapter()
appointmentsResourcesAdapter.Fill(Me.SchedulerDataDataSet.TransientAppointmentsResources)
' End If
29 Answers, 1 is accepted
Yes, the data source must be loaded with data. In the data binding example of RadScheduler for WinForms notice (in the BindToDataSet method) that the dataset tables are filled with data before setting them as data sources to the SchedulerBindingDataSource.
I hope this helps. Do not hesitate to write again if you have further questions.
Best wishes,
Jordan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Hi Jordan
Thanks for replying to my question, I know have only one issue with the scheduler ! When I add a resource to an appointment it is not saved I cannot spot the issue will you have a look at the code and advice me?
‘code used to load scheduler
Try
'If Me.SchedulerDataDataSet Is Nothing Then
Me.SchedulerDataDataSet = New SchedulerDataDataSet()
Dim appointmentsAdapter As New AppointmentsTableAdapter()
appointmentsAdapter.Fill(Me.SchedulerDataDataSet.Appointments)
Dim resourcesAdapter As New ResourcesTableAdapter()
resourcesAdapter.Fill(Me.SchedulerDataDataSet.Resources)
Dim appointmentsResourcesAdapter As New TransientAppointmentsResourcesTableAdapter()
appointmentsResourcesAdapter.Fill(Me.SchedulerDataDataSet.TransientAppointmentsResources)
' End If
Dim dataSource As New SchedulerBindingDataSource()
Dim appointmentMappingInfo As New AppointmentMappingInfo()
appointmentMappingInfo.Start = "Start"
appointmentMappingInfo.End = "End"
appointmentMappingInfo.Summary = "Summary"
appointmentMappingInfo.Description = "Description"
appointmentMappingInfo.Location = "Location"
appointmentMappingInfo.BackgroundId = "BackgroundID"
appointmentMappingInfo.StatusId = "StatusID"
appointmentMappingInfo.Resources = "Appointments_AppointmentsResources"
appointmentMappingInfo.ResourceId = "ResourceID"
appointmentMappingInfo.RecurrenceRule = "RecurrenceRule"
dataSource.EventProvider.Mapping = appointmentMappingInfo
dataSource.EventProvider.DataSource = Me.SchedulerDataDataSet.Appointments
Dim resourceMappingInfo As New ResourceMappingInfo()
resourceMappingInfo.Id = "ID"
resourceMappingInfo.Name = "Name"
dataSource.ResourceProvider.Mapping = resourceMappingInfo
dataSource.ResourceProvider.DataSource = Me.SchedulerDataDataSet.Resources
Me.RadScheduler1.DataSource = dataSource
Me.DockPanel2.DockPosition = Docking.DockPosition.Left
Me.DockPanel2.DockState = Docking.DockState.AutoHide
Me.RadSchedulerNavigator1.Top = 0
Catch ex As Exception
MsgBox(Err.Description)
End Try
‘Code to save data
Private Sub SaveChanges()
Dim appointmentsAdapter As New AppointmentsTableAdapter()
appointmentsAdapter.Update(Me.SchedulerDataDataSet.Appointments)
Dim appointmentsResourcesAdapter As New TransientAppointmentsResourcesTableAdapter() appointmentsResourcesAdapter.Update(Me.SchedulerDataDataSet.TransientAppointmentsResources)
End Sub
I just tried assigning a resource to an appointment and then saving that to the data source, but it seems there is some issue with the latest version of RadScheduler.
I will have to investigate more and follow up later with a detailed answer.
All the best,
Jordan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I found the reason for the issue that I mentioned earlier. The relation in the data set was missing so there was no way that the resources could work.
Please, check if that is the problem. Please notice how in the line below the Resources property is assigned the name of the relation:
appointmentMappingInfo.Resources = "Appointments_AppointmentsResources"
It is very important that there is a relation in the data set and it has the same name [as the one set to the property]. Otherwise the data binding functionality will not be able to find the resources.
If that is not the case I will most probably need a sample project that demonstrates the issue in order to help you further.
Greetings,
Jordan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I'm currently sitting on nearly the same problem.
Difference is, i'm using C# instead of VB.NET.
I followed your instructions in this Thread, but i'm getting following exception:
bei System.Data.DataView.System.Collections.IList.Clear() |
bei Telerik.WinControls.UI.Scheduler.SimpleResourceIdMapper.ClearResourceIds() |
bei Telerik.WinControls.UI.SchedulerBindingDataSource.EventBindingProvider.ProcessSchedulerItem(IEvent schedulerItem, Object dataSourceItem, SchedulerMapping mapping, PropertyDescriptor dataItemProperty) |
bei Telerik.WinControls.UI.Scheduler.BindingProviderBase`1.UpdateDataItemProperties(Object item, T schedulerItem) |
bei Telerik.WinControls.UI.Scheduler.BindingProviderBase`1.Insert(T itemToInsert) |
bei Telerik.WinControls.UI.RadScheduler.OnAddAppointments(IList list) |
bei Telerik.WinControls.UI.RadScheduler.appointments_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) |
bei Telerik.WinControls.Data.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e) |
bei Telerik.WinControls.Data.ObservableCollection`1.NotifyListenersCollectionChanged(NotifyCollectionChangedEventArgs e) |
bei Telerik.WinControls.Data.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) |
bei Telerik.WinControls.Data.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedAction action, Object item, Int32 index) |
bei Telerik.WinControls.Data.ObservableCollection`1.InsertItem(Int32 index, T item, Action`1 approvedAction) |
bei Telerik.WinControls.Data.ObservableCollection`1.InsertItem(Int32 index, T item) |
bei Telerik.WinControls.UI.SchedulerAppointmentCollection.InsertItem(Int32 index, IEvent item) |
bei System.Collections.ObjectModel.Collection`1.Add(T item) |
bei Telerik.WinControls.UI.RadScheduler.appointmentItem_Click(Object sender, EventArgs e) |
bei Telerik.WinControls.RadItem.OnClick(EventArgs e) |
bei Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e) |
bei Telerik.WinControls.UI.RadMenuItemBase.OnClick(EventArgs e) |
bei Telerik.WinControls.UI.RadMenuItem.OnClick(EventArgs e) |
bei Telerik.WinControls.RadItem.DoClick(EventArgs e) |
bei Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) |
bei Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args) |
bei Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) |
bei Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args) |
bei Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e) |
bei Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e) |
bei Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e) |
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) |
bei System.Windows.Forms.Control.WndProc(Message& m) |
bei System.Windows.Forms.ScrollableControl.WndProc(Message& m) |
bei Telerik.WinControls.RadControl.WndProc(Message& m) |
bei Telerik.WinControls.UI.RadPopupControl.WndProc(Message& m) |
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) |
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) |
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) |
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) |
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) |
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) |
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) |
bei System.Windows.Forms.Application.Run(Form mainForm) |
bei Vacation.Program.Main() in C:\Users\User\Documents\Visual Studio 2005\Projects\Vacation\Vacation\Program.cs:Zeile 17. |
bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) |
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) |
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() |
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) |
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) |
bei System.Threading.ThreadHelper.ThreadStart() |
This is just the Stacktrace.
Localisation is german, so i cant post the original trace.
I've tried to trace it manually, but there was no success
Kind regards
Thomas
Thank you for writing us.
Could you please send me a very simple application which demonstrates the erroneous behavior?
This will help me very much in further testing and debugging of the issue. Hopefully I will be able to provide you a better help and fix it in the application as the exception's call stack not really help me at the moment.
I'm looking forward to your reply.
Kind regards,
Boyko Markov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
i'm need your help, becouse i have same problem that you, When I add a resource to an appointment it is not saved, please can you help me to resolve this.
WHEN I CLICK THE "Update button" I GIVE THIS ERROR:
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_AppointmentsResources_Appointments". The conflict occurred in database "C:\DOCUMENTS AND SETTINGS\NUNEX2\DESKTOP\CONSULTASMEDICAS\BD\SCHEDULERDATA.MDF", table "dbo.Appointments", column 'ID'. The statement has been terminated.
i'm using Telerik winform Q3 2009, and cheduler control.
You can find the answer to your question in your support ticket. I have written there that you have to create and assign an appointment mapping.
Greetings,
Boyko Markov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
is it posible?..
like this
// Function Starts Here |
public IList<ClsAppData> GetAppointments_() |
{ |
ClsAppData objApp; |
IList<ClsAppData> AppList = new List<ClsAppData>(); |
try |
{ |
con.Open(); |
sql = "select ID,FirstName,LastName,Phone,Dob,Gender,Subject,Location,Start,[End],RecurrenceRule,Description from Appointments"; |
da = new SqlDataAdapter(sql, con); |
ds = new DataSet(); |
ds.Tables.Clear(); |
da.Fill(ds, "Appointments"); |
foreach (DataRow row in ds.Tables["Appointments"].Rows) |
{ |
objApp = new ClsAppData(); |
objApp.ID_ = Convert.ToInt32(row[0]); |
objApp.FirstName_ = Convert.ToString(row[1]); |
objApp.LastName_ = Convert.ToString(row[2]); |
objApp.Phone_ = Convert.ToString(row[3]); |
objApp.DtDob_ = Convert.ToDateTime(row[4]); |
objApp.Gender_ = Convert.ToInt32(row[5]); |
objApp.Subject_ = Convert.ToString(row[6]); |
objApp.Location_ = Convert.ToString(row[7]); |
objApp.DtStartDate_ = Convert.ToDateTime(row[8]); |
objApp.DtEndDate_ = Convert.ToDateTime(row[9]); |
objApp.RecurrenceRule_ = Convert.ToString(row[10]); |
objApp.Description_ = Convert.ToString(row[11]); |
AppList.Add(objApp); |
} |
} |
catch (Exception ex) |
{ System.Windows.Forms.MessageBox.Show(ex.Message); } |
finally |
{ con.Close(); } |
return AppList; |
} |
//Function End Here |
// Calling the above function and binding datas to scheduler |
try |
{ |
ClsAppFunc obj = new ClsAppFunc(); |
SchedulerBindingDataSource dataSource = new SchedulerBindingDataSource(); |
dataSource.EventProvider.AppointmentFactory = this.radScheduler1.AppointmentFactory; |
AppointmentMappingInfo info = new AppointmentMappingInfo(); |
info.UniqueId = "ID"; |
info.Summary = "FirstName"; |
info.Location = "Location"; |
info.Start = "Start"; |
info.End = "End"; |
info.RecurrenceRule = "RecurrenceRule"; |
info.Description = "Description"; |
info.Visible = "Visible"; |
dataSource.EventProvider.Mapping = info; |
////////////////////////////////////// |
IList<ClsAppData> AppList=new List<ClsAppData>(); |
AppList = obj.GetAppointments_(); |
dataSource.EventProvider.DataSource = AppList; |
///////////////////////////////////// |
this.radScheduler1.DataSource = dataSource; |
} |
catch (Exception ex) |
{ MessageBox.Show(ex.Message); } |
when excecuting the application the values are binding with empty values and placed on wrong location...
i won't bind datas using datatable or datasets...
please help me
thanks..
You could look at the demo example(Scheduler DataBinding). I hope that this will help you. If you have additional questions, feel free to ask.
All the best,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
To update AppointmentsResources table it is very important to set AppointmentMappingInfo properly. For the AppointmentMappingInfo you should set the ResourceId property to the ResourceId field name in the AppointmentsResources table, and for the Resources you should set the name of the relation between AppointmentsResources and Appointments. When you associate the resource to the appointment, a new record will be added to AppointmentsResources if there is no such.
More information about this you can find in our online documentation.
I hope this helps.
All the best,
Julian Benkov
the Telerik team
Interested, but can’t attend? Register anyway and we’ll send you the recording.
I have followed your instructions: For the AppointmentMappingInfo you should set the ResourceId property to the ResourceId field name in the AppointmentsResources table, and for the Resources you should set the name of the relation
But it still does not persist the resource. No errors, it just does not insert a record into the AppointmentsResources table.
Is there anything else I should check?
I am glad to hear that you managed to find a solution for the experienced problem. Do not hesitate to contact us if you have further questions or issues.
Regards, Julian Benkov
the Telerik team
I hope this helps.
Private
Sub
RadButton1_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
RadButton1.Click
CS_ScheduleInfo_ResourcesTableAdapter.Adapter.AcceptChangesDuringUpdate =
False
Dim
deletedChildRecords
As
ClientSchedulerDS.CS_ScheduleInfo_ResourcesDataTable = TryCast(
Me
.ClientSchedulerDS.CS_ScheduleInfo_Resources.GetChanges(DataRowState.Deleted), ClientSchedulerDS.CS_ScheduleInfo_ResourcesDataTable)
Dim
newChildRecords
As
ClientSchedulerDS.CS_ScheduleInfo_ResourcesDataTable = TryCast(
Me
.ClientSchedulerDS.CS_ScheduleInfo_Resources.GetChanges(DataRowState.Added), ClientSchedulerDS.CS_ScheduleInfo_ResourcesDataTable)
Dim
modifiedChildRecords
As
ClientSchedulerDS.CS_ScheduleInfo_ResourcesDataTable = TryCast(
Me
.ClientSchedulerDS.CS_ScheduleInfo_Resources.GetChanges(DataRowState.Modified), ClientSchedulerDS.CS_ScheduleInfo_ResourcesDataTable)
Try
If
deletedChildRecords IsNot
Nothing
Then
CS_ScheduleInfo_ResourcesTableAdapter.Update(deletedChildRecords)
End
If
CS_ScheduleInfoTableAdapter.Update(
Me
.ClientSchedulerDS.CS_ScheduleInfo)
If
newChildRecords IsNot
Nothing
Then
CS_ScheduleInfo_ResourcesTableAdapter.Update(newChildRecords)
End
If
If
modifiedChildRecords IsNot
Nothing
Then
CS_ScheduleInfo_ResourcesTableAdapter.Update(modifiedChildRecords)
End
If
Me
.ClientSchedulerDS.AcceptChanges()
ClientSchedulerDS.AcceptChanges()
Catch
ex
As
Exception
MessageBox.Show(
String
.Format(
"An error occurred during the update process:"
& vbLf &
"{0}"
, ex.Message))
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
So I have to change the connection string at runtime, in which I would like to use your code, however I don't know how to change the datasource to the dataset at run time. My other option is to do everything from code-behind and connect to the server and use stored producedures (which I have been trying to do) but running into issues. The code below is just a snippet of the save function. Perhaps you could give me some ideas on how to accomplish what I need? I've been on this issue for two weeks now and it's driven me pretty much insane. With the code below it will not add an entry to the AppointmentID (but it does to the ResourceID) and editing appointments do not save. I would have to think there is an easier way to accomplish this..
​
Public
Sub
SaveScheduler()
AppointmentsResourcesTableAdapter.AcceptChangesDuringUpdate =
False
Dim
deletedChildRecords = schedulerDataDataSet.GetChanges(DataRowState.Deleted)
Dim
newChildRecords = schedulerDataDataSet.GetChanges(DataRowState.Added)
Dim
modifiedChildRecords = schedulerDataDataSet.GetChanges(DataRowState.Modified)
connection =
New
SqlConnection(connectstring)
appointmentsResourcesTableAdapter.SelectCommand =
New
SqlCommand()
appointmentsResourcesTableAdapter.SelectCommand.Connection = connection
appointmentsResourcesTableAdapter.SelectCommand.CommandText =
"procGetAppointmentResources"
appointmentsResourcesTableAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
AppointmentsTableAdapter.SelectCommand =
New
SqlCommand()
AppointmentsTableAdapter.SelectCommand.Connection = connection
AppointmentsTableAdapter.SelectCommand.CommandText =
"procGetAppointments2"
AppointmentsTableAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
Try
If
deletedChildRecords IsNot
Nothing
Then
'If deletedChildRecords.Tables(2).Rows.Count > 0 Then
AppointmentsTableAdapter.DeleteCommand =
New
SqlCommand()
AppointmentsTableAdapter.DeleteCommand.Connection = connection
AppointmentsTableAdapter.DeleteCommand.CommandText =
"procGetAppointments2"
AppointmentsTableAdapter.DeleteCommand.CommandType = CommandType.StoredProcedure
Dim
cmdBuilder2
As
New
SqlClient.SqlCommandBuilder(AppointmentsTableAdapter)
AppointmentsTableAdapter.DeleteCommand = cmdBuilder2.GetDeleteCommand
appointmentsResourcesTableAdapter.DeleteCommand =
New
SqlCommand()
appointmentsResourcesTableAdapter.DeleteCommand.Connection = connection
appointmentsResourcesTableAdapter.DeleteCommand.CommandText =
"procGetAppointmentResources"
appointmentsResourcesTableAdapter.DeleteCommand.CommandType = CommandType.StoredProcedure
Dim
cmdBuilder
As
New
SqlClient.SqlCommandBuilder(appointmentsResourcesTableAdapter)
appointmentsResourcesTableAdapter.DeleteCommand = cmdBuilder.GetDeleteCommand
'End If
End
If
If
newChildRecords IsNot
Nothing
Then
If
newChildRecords.Tables(2).Rows.Count > 0
Then
AppointmentsTableAdapter.InsertCommand =
New
SqlCommand()
AppointmentsTableAdapter.InsertCommand.Connection = connection
AppointmentsTableAdapter.InsertCommand.CommandText =
"procGetAppointments2"
AppointmentsTableAdapter.InsertCommand.CommandType = CommandType.StoredProcedure
Dim
cmdBuilder2
As
New
SqlClient.SqlCommandBuilder(AppointmentsTableAdapter)
AppointmentsTableAdapter.InsertCommand = cmdBuilder2.GetInsertCommand
appointmentsResourcesTableAdapter.InsertCommand =
New
SqlCommand()
appointmentsResourcesTableAdapter.InsertCommand.Connection = connection
appointmentsResourcesTableAdapter.InsertCommand.CommandText =
"procGetAppointmentResources"
appointmentsResourcesTableAdapter.InsertCommand.CommandType = CommandType.StoredProcedure
Dim
cmdBuilder
As
New
SqlClient.SqlCommandBuilder(appointmentsResourcesTableAdapter)
appointmentsResourcesTableAdapter.InsertCommand = cmdBuilder.GetInsertCommand
End
If
End
If
If
modifiedChildRecords IsNot
Nothing
Then
If
modifiedChildRecords.Tables(2).Rows.Count > 0
Then
AppointmentsTableAdapter.UpdateCommand =
New
SqlCommand()
AppointmentsTableAdapter.UpdateCommand.Connection = connection
AppointmentsTableAdapter.UpdateCommand.CommandText =
"procGetAppointments2"
AppointmentsTableAdapter.UpdateCommand.CommandType = CommandType.StoredProcedure
Dim
cmdBuilder2
As
New
SqlClient.SqlCommandBuilder(AppointmentsTableAdapter)
AppointmentsTableAdapter.UpdateCommand = cmdBuilder2.GetUpdateCommand
appointmentsResourcesTableAdapter.UpdateCommand =
New
SqlCommand()
appointmentsResourcesTableAdapter.UpdateCommand.Connection = connection
appointmentsResourcesTableAdapter.UpdateCommand.CommandText =
"procGetAppointmentResources"
appointmentsResourcesTableAdapter.UpdateCommand.CommandType = CommandType.StoredProcedure
Dim
cmdBuilder
As
New
SqlClient.SqlCommandBuilder(appointmentsResourcesTableAdapter)
appointmentsResourcesTableAdapter.UpdateCommand = cmdBuilder.GetUpdateCommand
End
If
End
If
BindingContext(schedulerDataDataSet.Tables(
"Appointments"
)).EndCurrentEdit()
BindingContext(schedulerDataDataSet.Tables(
"AppointmentsResources"
)).EndCurrentEdit()
AppointmentsTableAdapter.Update(
Me
.schedulerDataDataSet.Tables(
"Appointments"
))
appointmentsResourcesTableAdapter.Update(
Me
.schedulerDataDataSet.Tables(
"AppointmentsResources"
))
Me
.schedulerDataDataSet.AcceptChanges()
Catch
ex
As
Exception
MessageBox.Show(
String
.Format(
"An error occurred during the update process:"
& vbLf &
"{0}"
, ex.Message))
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
(And you can call me Tim)
I don't use resources anymore. If I remember correctly I was trying to see if I could treat an employee as a resource but apparently that never worked out for me. Also, I don't typically use the dataset GUI or table adapters. I did in this project because that's how the examples were written so I went with it. (I have a custom dll based off one of Microsoft's old Application Blocks call SQLHelper and I use that for data access.)
I modify my connection string at runtime as well. The application is designed to be implemented on the local servers of our customers.
As far as handling edits, I had to create event handlers for changes and deletions to the table the scheduler was bound to:
AddHandler
Me
.ClientSchedulerDS.Tables(
"CS_ScheduleInfo"
).RowChanged,
New
DataRowChangeEventHandler(
AddressOf
SaveChanges)
AddHandler
Me
.ClientSchedulerDS.Tables(
"CS_ScheduleInfo"
).RowDeleted,
New
DataRowChangeEventHandler(
AddressOf
SaveChanges)
The SaveChanges sub:
Private
Sub
SaveChanges(sender
As
Object
, e
As
System.Data.DataRowChangeEventArgs)
Try
If
Not
Me
.updating
AndAlso
Not
Me
._loading
Then
Me
.updating =
True
Me
.CS_ScheduleInfoTableAdapter.Adapter.AcceptChangesDuringUpdate =
False
CS_ScheduleInfoTableAdapter.Update(
Me
.ClientSchedulerDS.CS_ScheduleInfo)
Me
.ClientSchedulerDS.CS_ScheduleInfo.AcceptChanges()
Me
.updating =
False
Me
.rleStatus.Text =
"Changes saved."
End
If
Catch
ex
As
Exception
MessageBox.Show(ex.Message,
"Error"
, MessageBoxButtons.OK, MessageBoxIcon.
Error
)
InsertErrorLog(Now, GetExecutingAssembly.FullName, GetCurrentMethod.Name, My.User.Name, My.Computer.Name, ex.ToString(), ErrorLevel.
Error
, ex)
End
Try
End
Sub
The only advice I can give at this point is to go over and over the online documentation to make sure you're following their guidelines. Also, you may want to create a separate post or ask Telerik if they can help.
Good luck.
However, I can add an appointment but when I start using the GroupType I am having issues. It inserts a negative incrementing number (-1, -2, etc..) into the AppointmentID field instead of using the ID number of the Appointment Table. Not sure what I am doing wrong, I have all the mapping correct. Below is my code if someone could help me out?
​
Private
Function
Appointments_CollectionChanged(
ByVal
sender
As
Object
,
ByVal
e
As
NotifyCollectionChangedEventArgs)
As
String
If
e.Action <> Telerik.WinControls.Data.NotifyCollectionChangedAction.Batch
Then
AppointmentsResourcesTableAdapter.Adapter.AcceptChangesDuringUpdate =
False
Dim
deletedChildRecords
As
spis_beSQLDataSet.AppointmentsResourcesDataTable = TryCast(
Me
.Spis_beSQLDataSet.AppointmentsResources.GetChanges(DataRowState.Deleted), spis_beSQLDataSet.AppointmentsResourcesDataTable)
Dim
newChildRecords
As
spis_beSQLDataSet.AppointmentsResourcesDataTable = TryCast(
Me
.Spis_beSQLDataSet.AppointmentsResources.GetChanges(DataRowState.Added), spis_beSQLDataSet.AppointmentsResourcesDataTable)
Dim
modifiedChildRecords
As
spis_beSQLDataSet.AppointmentsResourcesDataTable = TryCast(
Me
.Spis_beSQLDataSet.AppointmentsResources.GetChanges(DataRowState.Modified), spis_beSQLDataSet.AppointmentsResourcesDataTable)
Try
If
deletedChildRecords IsNot
Nothing
Then
AppointmentsResourcesTableAdapter.Update(deletedChildRecords)
End
If
AppointmentsTableAdapter.Update(
Me
.Spis_beSQLDataSet.Appointments)
If
newChildRecords IsNot
Nothing
Then
AppointmentsResourcesTableAdapter.Update(newChildRecords)
End
If
If
modifiedChildRecords IsNot
Nothing
Then
AppointmentsResourcesTableAdapter.Update(modifiedChildRecords)
End
If
AppointmentsResourcesTableAdapter.Update(
Me
.Spis_beSQLDataSet.AppointmentsResources)
Me
.Spis_beSQLDataSet.AcceptChanges()
Catch
ex
As
Exception
MessageBox.Show(
String
.Format(
"An error occurred during the update process:"
& vbLf &
"{0}"
, ex.Message))
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
If
End
Function
Thank you for contacting us.
Our Data Binding Walkthrough help article is quite useful about this topic. Note that in addition it is necessary to add a relation Appointments_Appointments1, linking "ID" to "ParentID" fields in the Appointments table. Thus, you will be able to save an exceptional appointment as a separate appointment in the data table.
We noticed that you have already opened another thread, related to this matter, I would kindly ask you to use just one thread for a specific problem to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.
Thank you for your understanding.
Regards,
Desislava
Telerik
​appointmentsResourcesTableAdapter.Adapter.AcceptChangesDuringUpdate =
False
Dim
deletedChildRecords
As
spis_beSQLDataSet.AppointmentsResourcesDataTable = TryCast(
Me
.Spis_beSQLDataSet.AppointmentsResources.GetChanges(DataRowState.Deleted), spis_beSQLDataSet.AppointmentsResourcesDataTable)
Dim
newChildRecords
As
spis_beSQLDataSet.AppointmentsResourcesDataTable = TryCast(
Me
.Spis_beSQLDataSet.AppointmentsResources.GetChanges(DataRowState.Added), spis_beSQLDataSet.AppointmentsResourcesDataTable)
Dim
modifiedChildRecords
As
spis_beSQLDataSet.AppointmentsResourcesDataTable = TryCast(
Me
.Spis_beSQLDataSet.AppointmentsResources.GetChanges(DataRowState.Modified), spis_beSQLDataSet.AppointmentsResourcesDataTable)
Thank you for writing back.
The relation "Appointments_Appointments1" should be mapped with the AppointmentMappingInfo.Exceptions property:
appointmentMappingInfo.Exceptions =
"Appointments_Appointments1"
As to the question related to drag and drop behavior of the appointments I was unable to reproduce the problem that you are facing on my end. Editing appointment via the EditAppointment dialog is the same as drag and drop behavior for the specific appointment. In both cases the start/end dates of the appointment are changed and these modifications are reflected in the database. Please find attached a sample video (drag and drop over the browser to play), demonstrating the behavior on my end. I have also attached my sample project together with the .bak file form my SQL database.
Please do not hesitate to contact us if you have any additional questions.
Regards,
Desislava
Telerik
DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!