Hi all,
I read the tutorials hoe to use inline templates to create appointment, but I have some bit confusion using it.Because my application using a resource grouping and I only need Inline insert and edit templates no advanced form needed.As my code looks like
The CS code contains
But when I insert a appointment the form created event fires twice and I don't get the start time and end time as I given, Also the Edit is not working. Another problem is when I insert a appointment for Resource3 it will come under both Resource1 and Resource3 in GUI
My requirement is to call a function to insert the appointment values to a DB table on click save or update.
I am stuck for three days for this. Can you please give me a guide to do this stuff?
I read the tutorials hoe to use inline templates to create appointment, but I have some bit confusion using it.Because my application using a resource grouping and I only need Inline insert and edit templates no advanced form needed.As my code looks like
| <telerik:RadScheduler ID="scheduler" runat="server" Width="100%" Height="80%" Skin="Office2007" |
| DataKeyField="Name" DataStartField="Start" DataEndField="End" DataSubjectField="Subject" |
| ShowFooter="false" MinutesPerRow="15" TimeLabelRowSpan="4" RowHeaderWidth="40px" |
| ShowFullTime="true" OverflowBehavior="Scroll" ShowAllDayRow="false" Font-Names="Segoe UI" |
| Font-Size="12px" GroupBy="Provider" GroupingDirection="Horizontal" HoursPanelTimeFormat="h ttt" |
| MinimumInlineFormHeight="180" MinimumInlineFormWidth="250" OnAppointmentCreated="OnAppointmentCreated" |
| OnAppointmentCommand="OnAppointmentCommand" OnFormCreated="OnFormCreated" OnFormCreating="OnFormCreating"> |
| <InlineInsertTemplate> |
| <fieldset> |
| <table> |
| <tr> |
| <td><label>Subject</label> </td> |
| <td> |
| <asp:TextBox ID="txtSubject" runat="server" Width="160px" Height="50px" /> |
| </td> |
| </tr> |
| <tr> |
| <td><label>Type</label> </td> |
| <td> |
| <asp:DropDownList ID="ddlType" runat="server" Width="160px" /> |
| </td> |
| </tr> |
| <tr> |
| <td><label>Start</label> </td> |
| <td> |
| <telerik:RadDateTimePicker ID="tpStartTime" runat="server" Width="160px" Skin="Office2007" /> |
| </td> |
| </tr> |
| <tr> |
| <td><label>End</label> </td> |
| <td> |
| <telerik:RadDateTimePicker ID="tpEndTime" runat="server" Width="160px" Skin="Office2007" /> |
| </td> |
| </tr> |
| <tr> |
| <td></td> |
| <td align="right"> |
| <table> |
| <tr> |
| <td> |
| <asp:Button ID="btnSave" Text="Save" runat="server" CommandName="Insert" /> |
| </td> |
| <td> |
| <asp:Button ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" CausesValidation="false" /> |
| </td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| </table> |
| </fieldset> |
| </InlineInsertTemplate> |
| <InlineEditTemplate> |
| <fieldset> |
| <table> |
| <tr> |
| <td><label>Subject</label> </td> |
| <td> |
| <asp:TextBox ID="txtSubject" runat="server" Width="160px" Height="50px" Text='<%# Bind("Subject") %>' /> |
| </td> |
| </tr> |
| <tr> |
| <td><label>Type</label> </td> |
| <td> |
| <asp:DropDownList ID="ddlType" runat="server" Width="160px" /> |
| </td> |
| </tr> |
| <tr> |
| <td><label>Date</label> </td> |
| <td> |
| <telerik:RadDateTimePicker ID="dpStartDate" runat="server" Width="160px" Skin="Office2007" /> |
| </td> |
| </tr> |
| <tr> |
| <td><label>End Date</label> </td> |
| <td> |
| <telerik:RadDateTimePicker ID="dpEndDate" runat="server" Width="160px" Skin="Office2007" /> |
| </td> |
| </tr> |
| <tr> |
| <td></td> |
| <td align="right"> |
| <table> |
| <tr> |
| <td> |
| <asp:Button ID="btnUpdate" Text="Save" runat="server" CommandName="Update" /> |
| </td> |
| <td> |
| <asp:Button ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" CausesValidation="false" /> |
| </td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| </table> |
| </fieldset> |
| </InlineEditTemplate> |
| <AppointmentTemplate> |
| <br /> |
| <%# Eval( "Subject" )%> |
| <br /> |
| <asp:Label runat="server" ID="lblType" /> |
| </AppointmentTemplate> |
| <TimelineView UserSelectable="false" /> |
| <TimeSlotContextMenuSettings EnableDefault="true" Skin="Office2007" /> |
| <AppointmentContextMenuSettings EnableDefault="true" Skin="Office2007" /> |
| </telerik:RadScheduler> |
| protected void Page_Load( object sender, EventArgs e ) |
| { |
| if( !IsPostBack ) |
| { |
| ResourceType resType = new ResourceType( "Provider" ); |
| resType.ForeignKeyField = "ProviderID"; |
| resType.TextField = "FullName"; |
| resType.KeyField = "ProviderId"; |
| resType.DataSource = providerList; // A list of providers with name and Id |
| scheduler.ResourceTypes.Add( resType ); |
| } |
| } |
| protected void OnAppointmentCreated( object sender, AppointmentCreatedEventArgs e ) |
| { |
| } |
| protected void OnAppointmentCommand( object sender, AppointmentCommandEventArgs e ) |
| { |
| appointmentData = new DTO.AppointmentData(); // User defined Class to store appointment |
| appointmentData.HospitalId = 1; |
| appointmentData.CreatedBy = 9; |
| appointmentData.Date = scheduler.SelectedDate; |
| appointmentData.ProviderID = Convert.ToUInt32( e.Container.Appointment.Resources.GetResourceByType( "Provider" ).Key.ToString() ); |
| TextBox reason = (TextBox) e.Container.FindControl( "txtSubject" ); |
| appointmentData.VisitReason = reason.Text.Trim(); |
| RadDateTimePicker startTime = (RadDateTimePicker) e.Container.FindControl( "tpStartTime" ); |
| appointmentData.StartTime = Convert.ToDateTime( startTime.SelectedDate ); |
| RadDateTimePicker endTime = (RadDateTimePicker) e.Container.FindControl( "tpEndTime" ); |
| appointmentData.EndTime = Convert.ToDateTime( endTime.SelectedDate ); |
| DropDownList type = (DropDownList) e.Container.FindControl( "ddlType" ); |
| appointmentData.AppointmentType = type.SelectedValue; |
| BookAppointment( appointmentData ); |
| protected void OnFormCreated( object sender, SchedulerFormCreatedEventArgs e ) |
| { |
| if( e.Container.Mode == SchedulerFormMode.Insert ) |
| { |
| RadDateTimePicker startInput = (RadDateTimePicker) e.Container.FindControl( "tpStartTime" ); |
| startInput.SelectedDate = DateTime.Now; |
| RadDateTimePicker endInput = (RadDateTimePicker) e.Container.FindControl( "tpEndTime" ); |
| endInput.SelectedDate = DateTime.Now.AddMinutes( 30 ); |
| DropDownList type = (DropDownList) e.Container.FindControl( "ddlType" ); |
| type.DataTextField = "Name"; |
| type.DataValueField = "ConsultationDuration"; |
| type.DataSource = GetAllAppointmentTypes(); // Returns a list of appointments |
| type.DataBind(); |
| } |
| } |
| protected void OnFormCreating( object sender, SchedulerFormCreatingEventArgs e ) |
| { |
| } |
But when I insert a appointment the form created event fires twice and I don't get the start time and end time as I given, Also the Edit is not working. Another problem is when I insert a appointment for Resource3 it will come under both Resource1 and Resource3 in GUI
My requirement is to call a function to insert the appointment values to a DB table on click save or update.
I am stuck for three days for this. Can you please give me a guide to do this stuff?