I am trying to adapt the AdvancedForm Scheduler example to leverage the ObjectDataSource. However, it appears I am having problems with the parameter names on insert.
My Object which this is bound to
This worked fine for the basic example, but gets more complex with the AdvancedForm and new resources. I know this has something to do with my ObjectDataSource not having the correct parameters as I get the following error.
Any help on where I can find a collection or something of the proper parameters, or a better suggestion on how to do this would be welcome.
Many thanks.
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteAppointment" InsertMethod="InsertAppointment" SelectMethod="AllData" TypeName="Tradewind.Core.AppointmentList" UpdateMethod="UpdateAppointment"> <DeleteParameters> <asp:Parameter Name="ID" Type="String" /> </DeleteParameters> <UpdateParameters> <!-- Ignore - Trying to get Insert Only working right now --> <asp:Parameter Name="ID" Type="String" /> <asp:Parameter Name="Subject" Type="String" /> <asp:Parameter Name="Start" Type="DateTime" /> <asp:Parameter Name="End" Type="DateTime" /> <asp:Parameter Name="RecurrenceRule" Type="String" /> <asp:Parameter Name="RecurrenceParentID" Type="Object" /> <asp:Parameter Name="RecurrenceState" Type="Object" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="Subject" Type="String" /> <asp:Parameter Name="Start" Type="DateTime" /> <asp:Parameter Name="End" Type="DateTime" /> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="Reminder" Type="Object" /> <asp:Parameter Name="UserID" Type="Object" /> <asp:Parameter Name="RoomID" Type="Object" /> <asp:Parameter Name="RecurrenceRule" Type="String" /> <asp:Parameter Name="RecurrenceParentID" Type="Object" /> <asp:Parameter Name="RecurrenceRuleText" Type="String" /> <asp:Parameter Name="RecurrenceState" Type="Object" /> </InsertParameters></asp:ObjectDataSource><div class="exampleContainer"> <telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" DataEndField="End" DataKeyField="ID" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="ObjectDataSource1" DataStartField="Start" DataSubjectField="Subject" SelectedDate="2007-03-30" TimeZoneOffset="03:00:00" OnDataBound="RadScheduler1_DataBound" AppointmentStyleMode="Default" OnAppointmentCreated="RadScheduler1_AppointmentCreated" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" OnClientFormCreated="schedulerFormCreated" EnableDescriptionField="true"> <AdvancedForm Modal="true" /> <Reminders Enabled="true" /> <AppointmentTemplate> <div class="rsAptSubject"> <%# Eval("Subject") %> </div> <%# Eval("Description") %> </AppointmentTemplate> <AdvancedEditTemplate> <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>' Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Reminder='<%# Bind("Reminder") %>' UserID='<%# Bind("User") %>' RoomID='<%# Bind("Room") %>' /> </AdvancedEditTemplate> <AdvancedInsertTemplate> <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Reminder='<%# Bind("Reminder") %>' UserID='<%# Bind("User") %>' RoomID='<%# Bind("Room") %>' /> </AdvancedInsertTemplate> <TimelineView UserSelectable="false" /> <TimeSlotContextMenuSettings EnableDefault="true" /> <AppointmentContextMenuSettings EnableDefault="true" /> </telerik:RadScheduler>My Object which this is bound to
"Tradewind.Core.AppointmentList" looks like the following.public static void InsertAppointment( string Subject, DateTime Start, DateTime End, string Description, Object UserID, Object RoomID, string RecurrenceRule, Object RecurrenceParentID, string RecurrenceRuleText, Telerik.Web.UI.RecurrenceState RecurrenceState){ List<AppointmentInfo> sessApts = AllData(); AppointmentInfo ai = new AppointmentInfo(Subject, Start, End); ai.RecurrenceRule = RecurrenceRule; ai.RecurrenceParentID = RecurrenceParentID; ai.RecurrenceState = RecurrenceState; sessApts.Add(ai);}This worked fine for the basic example, but gets more complex with the AdvancedForm and new resources. I know this has something to do with my ObjectDataSource not having the correct parameters as I get the following error.
bjectDataSource 'ObjectDataSource1' could not find a non-generic method 'InsertAppointment' that has parameters: Subject, Start, End, Description, Reminder, UserID, RoomID, RecurrenceRule, RecurrenceParentID, RecurrenceRuleText, RecurrenceState, .Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.InvalidOperationException: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'InsertAppointment' that has parameters: Subject, Start, End, Description, Reminder, UserID, RoomID, RecurrenceRule, RecurrenceParentID, RecurrenceRuleText, RecurrenceState, .Source Error:An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.Stack Trace:[InvalidOperationException: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'InsertAppointment' that has parameters: Subject, Start, End, Description, Reminder, UserID, RoomID, RecurrenceRule, RecurrenceParentID, RecurrenceRuleText, RecurrenceState, .] Telerik.Web.UI.Scheduling.DataSourceViewSchedulerProvider.OnDataSourceOperationComplete(Int32 count, Exception e) +39 System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +80 Telerik.Web.UI.Scheduling.DataSourceViewSchedulerProvider.Insert(RadScheduler owner, Appointment appointmentToInsert) +184 Telerik.Web.UI.SchedulerProviderBase.Insert(ISchedulerInfo schedulerInfo, Appointment appointmentToInsert) +62 Telerik.Web.UI.Scheduling.AppointmentController.InsertAppointmentThroughProvider(ISchedulerInfo schedulerInfo, Appointment appointment) +101 Telerik.Web.UI.Scheduling.AppointmentController.InsertAppointment(ISchedulerInfo schedulerInfo, Appointment appointment) +40 Telerik.Web.UI.RadScheduler.InsertAppointmentInline() +282 Telerik.Web.UI.RadScheduler.OnBubbleEvent(Object source, EventArgs args) +483 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +125 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563Any help on where I can find a collection or something of the proper parameters, or a better suggestion on how to do this would be welcome.
Many thanks.