Hello Telerik Community!
I have a bit of a complex question and I need an answer as soon as possible.
I am using the RadScheduler and have binded it with a Web Service call and everything runs smoothly. I have essentially two questions.
First one is simpler:
The auto generated advanced insert form for this grid doesn't have a field for description. It comes up when it is bound with a DataSource like a SqlDataSource but not with the Web Service binding. Am I missing something or is that by design?
Second question is:
My client has requested that they want to be able to search for one of the resources for the appointment via a Grid where they filter the results and then select the one they want. Resources currently are only viewed via a RadComboBox which doesn't have enough functionality. The resource is a patient and they want to be able to search by SSN, DOB, Name etc so Grid is much better at filtering the results. I looked at the demo online and made a custom form and was able to generate it fine. The only issue is that now when I press the save button I get the following error:
http://www.screencast.com/t/mGjp47fj
However if I use the built in one it works fine. I will paste the code here of the AdvancedForm.ascx. It is the only thing I changed. I will also post the code for my radscheduler. I appreciate any insight! It's the last thing I need working before I am finished with this project so please helppp :) Thank you!
AdvancedForm.ascx:
AdvancedForm.ascx.cs"
/** can ignore this.. just me testing how to get the value for patients **/
RadScheduler code:
I have a bit of a complex question and I need an answer as soon as possible.
I am using the RadScheduler and have binded it with a Web Service call and everything runs smoothly. I have essentially two questions.
First one is simpler:
The auto generated advanced insert form for this grid doesn't have a field for description. It comes up when it is bound with a DataSource like a SqlDataSource but not with the Web Service binding. Am I missing something or is that by design?
Second question is:
My client has requested that they want to be able to search for one of the resources for the appointment via a Grid where they filter the results and then select the one they want. Resources currently are only viewed via a RadComboBox which doesn't have enough functionality. The resource is a patient and they want to be able to search by SSN, DOB, Name etc so Grid is much better at filtering the results. I looked at the demo online and made a custom form and was able to generate it fine. The only issue is that now when I press the save button I get the following error:
http://www.screencast.com/t/mGjp47fj
However if I use the built in one it works fine. I will paste the code here of the AdvancedForm.ascx. It is the only thing I changed. I will also post the code for my radscheduler. I appreciate any insight! It's the last thing I need working before I am finished with this project so please helppp :) Thank you!
AdvancedForm.ascx:
<%@ Control Language="C#" AutoEventWireup="True" Inherits="RadSchedulerAdvancedFormAdvancedForm" CodeBehind="AdvancedForm.ascx.cs" %><%@ Register TagPrefix="scheduler" TagName="ResourceControl" Src="ResourceControl.ascx" %><%@ Register TagPrefix="scheduler" TagName="MultipleValuesResourceControl" Src="MultipleValuesResourceControl.ascx" %><div class="rsAdvancedEdit rsAdvancedModal" style="position: relative"> <div class="rsModalBgTopLeft"> </div> <div class="rsModalBgTopRight"> </div> <div class="rsModalBgBottomLeft"> </div> <div class="rsModalBgBottomRight"> </div> <%-- Title bar. --%> <div class="rsAdvTitle"> <%-- The rsAdvInnerTitle element is used as a drag handle when the form is modal. --%> <h1 class="rsAdvInnerTitle"> <%= (this.Mode.ToString() == "Edit") ? Owner.Localization.AdvancedEditAppointment : Owner.Localization.AdvancedNewAppointment %></h1> <asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose" CommandName="Cancel" CausesValidation="false" ToolTip='<%# Owner.Localization.AdvancedClose %>'> <%= Owner.Localization.AdvancedClose %> </asp:LinkButton> </div> <div class="rsAdvContentWrapper"> <%-- Scroll container - when the form height exceeds MaximumHeight scrollbars will appear on this element--%> <div class="rsAdvOptionsScroll"> <asp:Panel runat="server" ID="AdvancedEditOptionsPanel" CssClass="rsAdvOptions"> <asp:Panel runat="server" ID="BasicControlsPanel" CssClass="rsAdvBasicControls" OnDataBinding="BasicControlsPanel_DataBinding"> <telerik:RadTextBox runat="server" ID="SubjectText" Width="100%" Label='<%# Owner.Localization.AdvancedSubject + ":" %>' EnableSingleInputRendering="false" /> <asp:RequiredFieldValidator runat="server" ID="SubjectValidator" ControlToValidate="SubjectText" EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" /> <ul class="rsTimePickers"> <li class="rsTimePick" style="width: 244px;"> <label for='<%= StartDate.ClientID %>_dateInput_text'> <%= Owner.Localization.AdvancedFrom %>: </label> <%-- Leaving a newline here will affect the layout, so we use a comment instead. --%><telerik:RadDatePicker runat="server" ID="StartDate" CssClass="rsAdvDatePicker" Width="83px" SharedCalendarID="SharedCalendar" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>' MinDate="1900-01-01"> <DatePopupButton Visible="False" /> <DateInput ID="DateInput2" runat="server" DateFormat='<%# Owner.AdvancedForm.DateFormat %>' EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" /> </telerik:RadDatePicker> <%-- --%><telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker" Width="65px" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'> <DateInput ID="DateInput3" runat="server" EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" /> <TimePopupButton Visible="false" /> <TimeView ID="TimeView1" runat="server" Columns="2" ShowHeader="false" StartTime="08:00" EndTime="18:00" Interval="00:30" /> </telerik:RadTimePicker> </li> <li class="rsTimeZonesWrapper"> <telerik:RadComboBox runat="server" Visible="true" ID="TimeZonesDropDown" Width="230" Label="<%# Owner.Localization.AdvancedTimeZone + ':' %>" Skin='<%# Owner.Skin %>'> </telerik:RadComboBox> </li> <li class="rsAllDayWrapper"> <asp:CheckBox runat="server" ID="AllDayEvent" CssClass="rsAdvChkWrap" Checked="false" /> </li> <li class="rsTimePick rsEndTimePick" style="width: 244px;"> <label for='<%= EndDate.ClientID %>_dateInput_text'> <%= Owner.Localization.AdvancedTo%>: </label> <%-- --%><telerik:RadDatePicker runat="server" ID="EndDate" CssClass="rsAdvDatePicker" Width="83px" SharedCalendarID="SharedCalendar" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>' MinDate="1900-01-01"> <DatePopupButton Visible="False" /> <DateInput ID="DateInput4" runat="server" DateFormat='<%# Owner.AdvancedForm.DateFormat %>' EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" /> </telerik:RadDatePicker> <%-- FT --%><telerik:RadTimePicker runat="server" ID="EndTime" CssClass="rsAdvTimePicker" Width="65px" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'> <DateInput ID="DateInput5" runat="server" EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" /> <TimePopupButton Visible="false" /> <TimeView ID="TimeView2" runat="server" Columns="2" ShowHeader="false" StartTime="08:00" EndTime="18:00" Interval="00:30" /> </telerik:RadTimePicker> </li> </ul> <div class="rsReminderWrapper"> <telerik:RadComboBox runat="server" ID="ReminderDropDown" Label="<%# Owner.Localization.Reminder + ':' %>" Width="120px" Skin='<%# Owner.Skin %>'> <Items> <telerik:RadComboBoxItem Text='<%# Owner.Localization.ReminderNone %>' Value="" /> <telerik:RadComboBoxItem Text='<%# "0 " + Owner.Localization.ReminderMinutes %>' Value="0" /> <telerik:RadComboBoxItem Text='<%# "5 " + Owner.Localization.ReminderMinutes %>' Value="5" /> <telerik:RadComboBoxItem Text='<%# "10 " + Owner.Localization.ReminderMinutes %>' Value="10" /> <telerik:RadComboBoxItem Text='<%# "15 " + Owner.Localization.ReminderMinutes %>' Value="15" /> <telerik:RadComboBoxItem Text='<%# "30 " + Owner.Localization.ReminderMinutes %>' Value="30" /> <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderHour %>' Value="60" /> <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderHours %>' Value="120" /> <telerik:RadComboBoxItem Text='<%# "3 " + Owner.Localization.ReminderHours %>' Value="180" /> <telerik:RadComboBoxItem Text='<%# "4 " + Owner.Localization.ReminderHours %>' Value="240" /> <telerik:RadComboBoxItem Text='<%# "5 " + Owner.Localization.ReminderHours %>' Value="300" /> <telerik:RadComboBoxItem Text='<%# "6 " + Owner.Localization.ReminderHours %>' Value="360" /> <telerik:RadComboBoxItem Text='<%# "7 " + Owner.Localization.ReminderHours %>' Value="420" /> <telerik:RadComboBoxItem Text='<%# "8 " + Owner.Localization.ReminderHours %>' Value="480" /> <telerik:RadComboBoxItem Text='<%# "9 " + Owner.Localization.ReminderHours %>' Value="540" /> <telerik:RadComboBoxItem Text='<%# "10 " + Owner.Localization.ReminderHours %>' Value="600" /> <telerik:RadComboBoxItem Text='<%# "11 " + Owner.Localization.ReminderHours %>' Value="660" /> <telerik:RadComboBoxItem Text='<%# "12 " + Owner.Localization.ReminderHours %>' Value="720" /> <telerik:RadComboBoxItem Text='<%# "18 " + Owner.Localization.ReminderHours %>' Value="1080" /> <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderDays %>' Value="1440" /> <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderDays %>' Value="2880" /> <telerik:RadComboBoxItem Text='<%# "3 " + Owner.Localization.ReminderDays %>' Value="4320" /> <telerik:RadComboBoxItem Text='<%# "4 " + Owner.Localization.ReminderDays %>' Value="5760" /> <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderWeek %>' Value="10080" /> <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderWeeks %>' Value="20160" /> </Items> </telerik:RadComboBox> </div> <asp:RequiredFieldValidator runat="server" ID="StartDateValidator" ControlToValidate="StartDate" EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" /> <asp:RequiredFieldValidator runat="server" ID="StartTimeValidator" ControlToValidate="StartTime" EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" /> <asp:RequiredFieldValidator runat="server" ID="EndDateValidator" ControlToValidate="EndDate" EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" /> <asp:RequiredFieldValidator runat="server" ID="EndTimeValidator" ControlToValidate="EndTime" EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" /> <asp:CustomValidator runat="server" ID="DurationValidator" ControlToValidate="StartDate" EnableClientScript="false" Display="Dynamic" CssClass="rsValidatorMsg rsInvalid" OnServerValidate="DurationValidator_OnServerValidate" /> </asp:Panel> <asp:Panel runat="server" ID="AdvancedControlsPanel" CssClass="rsAdvMoreControls"> <%-- <label> Color: </label> <telerik:RadColorPicker ID="AppointmentColorPicker" runat="server" CssClass="rsAdvResourceValue" ShowIcon="true" PaletteModes="WebPalette"> </telerik:RadColorPicker>--%> <table> <tr> <td>Search Patient: </td> </tr> <tr> <td> <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellSpacing="0" DataSourceID="SqlDataSourceAllPats" GridLines="None" AllowFilteringByColumn="True" AllowPaging="True" EnableLinqExpressions="False" Width="600px" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged"> <MasterTableView Width="600px" DataSourceID="SqlDataSourceAllPats" AutoGenerateColumns="False" DataKeyNames="Account_Number" ClientDataKeyNames="Account_Number"> <CommandItemSettings ExportToPdfText="Export to PDF" /> <Columns> <telerik:GridButtonColumn HeaderText="" Text="Select" CommandName="Select" /> <telerik:GridBoundColumn FilterControlAltText="Filter Account_Number column" HeaderText="Acct No" UniqueName="AcctNo" DataField="Account_Number" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith" ShowFilterIcon="false" EmptyDataText="" Visible="true" ItemStyle-Width="60px" HeaderStyle-Width="60px"> </telerik:GridBoundColumn> <telerik:GridBoundColumn FilterControlAltText="Filter FirstName column" HeaderText="First Name" UniqueName="FirstName" DataField="FirstName" EmptyDataText="" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith" ShowFilterIcon="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn FilterControlAltText="Filter LastName column" HeaderText="Last Name" UniqueName="LastName" DataField="LastName" EmptyDataText="" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith" ShowFilterIcon="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn FilterControlAltText="Filter Birthdate column" HeaderText="Date of Birth" UniqueName="Birthdate" DataField="Birthdate" EmptyDataText="" DataFormatString="{0:MM/dd/yyyy}"> </telerik:GridBoundColumn> <telerik:GridBoundColumn FilterControlAltText="Filter SSN column" HeaderText="SSN" UniqueName="SSN" DataField="SSN" EmptyDataText="" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith" ShowFilterIcon="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn FilterControlAltText="Filter Address column" HeaderText="Address" UniqueName="Address" DataField="Address" EmptyDataText=""> </telerik:GridBoundColumn> </Columns> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True"> <HeaderStyle Width="20px" /> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True"> <HeaderStyle Width="20px" /> </ExpandCollapseColumn> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"> </EditColumn> </EditFormSettings> </MasterTableView> <FilterMenu EnableImageSprites="False"> </FilterMenu> <ClientSettings> <Scrolling AllowScroll="true"></Scrolling> </ClientSettings> </telerik:RadGrid> </td> </tr> </table> <asp:SqlDataSource ID="SqlDataSourceAllPats" runat="server" ConnectionString="<%$ ConnectionStrings:kcMedic_Central_Connection %>" SelectCommand="sp_patientList" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter DefaultValue="C002" Name="SITE_ID_LNK" SessionField="SiteId" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:Panel runat="server" ID="ResourceControls"> <%-- RESOURCE CONTROLS --%> <ul class="rsResourceControls"> <li> <!-- Resource controls should follow the convention Res[Resource Name] for ID --> <scheduler:ResourceControl runat="server" ID="ResPatient" Type="Patient" Label="Patient:" Skin='<%# Owner.Skin %>' /> </li> <li> <scheduler:ResourceControl runat="server" ID="ResPhysician" Type="Physician" Label="Physician: " /> </li> <li> <!-- Resource controls should follow the convention Res[Resource Name] for ID --> <scheduler:ResourceControl runat="server" ID="ResFacility" Type="Facility" Label="Facility:" Skin='<%# Owner.Skin %>' /> </li> <li> <!-- Resource controls should follow the convention Res[Resource Name] for ID --> <scheduler:ResourceControl runat="server" ID="ResApptType" Type="ApptType" Label="ApptType:" Skin='<%# Owner.Skin %>' /> </li> <!-- Optionally add more ResourceControl instances here --> </ul> </asp:Panel> </asp:Panel> <telerik:RadTextBox runat="server" ID="DescriptionText" TextMode="MultiLine" Columns="50" Rows="5" Width="100%" Label='<%# Owner.Localization.AdvancedDescription + ":" %>' Text='<%# Eval("Description") %>' EnableSingleInputRendering="false" /> <span class="rsAdvResetExceptions"> <asp:LinkButton runat="server" Visible="false" ID="ResetExceptions" OnClick="ResetExceptions_OnClick" /> </span> <telerik:RadSchedulerRecurrenceEditor runat="server" ID="AppointmentRecurrenceEditor" /> <asp:HiddenField runat="server" ID="OriginalRecurrenceRule" /> <telerik:RadCalendar runat="server" ID="SharedCalendar" Skin='<%# Owner.Skin %>' CultureInfo='<%# Owner.Culture %>' ShowRowHeaders="false" RangeMinDate="1900-01-01" /> </asp:Panel> </div> <asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea"> <div class="rsAdvButtonWrapper"> <asp:LinkButton runat="server" ID="UpdateButton" CssClass="rsAdvEditSave"> <span><%= Owner.Localization.Save %></span> </asp:LinkButton> <asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel" CausesValidation="false"> <span><%= Owner.Localization.Cancel %></span> </asp:LinkButton> </div> </asp:Panel> </div> </div>AdvancedForm.ascx.cs"
using System;using System.ComponentModel;using System.Web.UI;using System.Web.UI.WebControls;using System.Drawing;using Telerik.Web.UI;public enum RadSchedulerAdvancedFormAdvancedFormMode{ Insert, Edit}public partial class RadSchedulerAdvancedFormAdvancedForm : System.Web.UI.UserControl{ #region Private members private bool FormInitialized { get { return (bool)(ViewState["FormInitialized"] ?? false); } set { ViewState["FormInitialized"] = value; } } private RadSchedulerAdvancedFormAdvancedFormMode mode = RadSchedulerAdvancedFormAdvancedFormMode.Insert; #endregion #region Protected properties protected RadScheduler Owner { get { return Appointment.Owner; } } protected Appointment Appointment { get { SchedulerFormContainer container = (SchedulerFormContainer)BindingContainer; return container.Appointment; } } #endregion #region Attributes and resources [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public string Description { get { return DescriptionText.Text; } set { DescriptionText.Text = value; } } //public string AppointmentColor //{ // get // { // // No color selected // if (AppointmentColorPicker.SelectedColor.A == 0) // return null; // return AppointmentColorPicker.SelectedColor.ToArgb().ToString(); // } // set // { // if (string.IsNullOrEmpty(value)) // return; // int argbValue; // if (int.TryParse(value, out argbValue)) // AppointmentColorPicker.SelectedColor = Color.FromArgb(argbValue); // } //} [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public object Patient { get { return ResPatient.Value; } set { ResPatient.Value = value; } } [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public object Physician { get { return ResPhysician.Value; } set { ResPhysician.Value = value; } } [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public object Facility { get { return ResFacility.Value; } set { ResFacility.Value = value; } } [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public object ApptType { get { return ResApptType.Value; } set { ResApptType.Value = value; } } #endregion #region Public properties public RadSchedulerAdvancedFormAdvancedFormMode Mode { get { return mode; } set { mode = value; } } [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public string Subject { get { return SubjectText.Text; } set { SubjectText.Text = value; } } [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public DateTime Start { get { DateTime result = StartDate.SelectedDate.Value.Date; if (AllDayEvent.Checked) { result = result.Date; } else { TimeSpan time = StartTime.SelectedDate.Value.TimeOfDay; result = result.Add(time); } return Owner.DisplayToUtc(result); } set { StartDate.SelectedDate = Owner.UtcToDisplay(value); StartTime.SelectedDate = Owner.UtcToDisplay(value); } } [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public DateTime End { get { DateTime result = EndDate.SelectedDate.Value.Date; if (AllDayEvent.Checked) { result = result.Date.AddDays(1); } else { TimeSpan time = EndTime.SelectedDate.Value.TimeOfDay; result = result.Add(time); } return Owner.DisplayToUtc(result); } set { EndDate.SelectedDate = Owner.UtcToDisplay(value); EndTime.SelectedDate = Owner.UtcToDisplay(value); } } //[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] //public string RecurrenceRuleText //{ // get // { // if (Owner.RecurrenceSupport) // { // bool dateSpecified = StartDate.SelectedDate.HasValue && EndDate.SelectedDate.HasValue; // bool timeSpecified = StartTime.SelectedDate.HasValue && EndTime.SelectedDate.HasValue; // if ((AllDayEvent.Checked && !dateSpecified) || // (!AllDayEvent.Checked && !(dateSpecified && timeSpecified))) // { // return string.Empty; // } // AppointmentRecurrenceEditor.StartDate = Start; // AppointmentRecurrenceEditor.EndDate = End; // RecurrenceRule rrule = AppointmentRecurrenceEditor.RecurrenceRule; // if (rrule == null) // { // return string.Empty; // } // RecurrenceRule originalRule; // if (RecurrenceRule.TryParse(OriginalRecurrenceRule.Value, out originalRule)) // { // rrule.Exceptions = originalRule.Exceptions; // } // if (rrule.Range.RecursUntil != DateTime.MaxValue) // { // rrule.Range.RecursUntil = Owner.DisplayToUtc(rrule.Range.RecursUntil); // if (!AllDayEvent.Checked) // { // rrule.Range.RecursUntil = rrule.Range.RecursUntil.AddDays(1); // } // } // return rrule.ToString(); // } // return string.Empty; // } // set // { // RecurrenceRule rrule; // RecurrenceRule.TryParse(value, out rrule); // if (rrule != null) // { // if (rrule.Range.RecursUntil != DateTime.MaxValue) // { // DateTime recursUntil = Owner.UtcToDisplay(rrule.Range.RecursUntil); // if (!IsAllDayAppointment(Appointment)) // { // recursUntil = recursUntil.AddDays(-1); // } // rrule.Range.RecursUntil = recursUntil; // } // AppointmentRecurrenceEditor.RecurrenceRule = rrule; // OriginalRecurrenceRule.Value = value; // } // } //} //[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] //public string Reminder //{ // get // { // if (Owner.RemindersSupport && ReminderDropDown.SelectedValue != string.Empty) // { // return ReminderDropDown.SelectedValue; // } // return string.Empty; // } // set // { // RadComboBoxItem item = ReminderDropDown.Items.FindItemByValue(value); // if (item != null) // { // item.Selected = true; // } // } //} [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] public string TimeZoneID { get { return TimeZonesDropDown.SelectedValue; } set { RadComboBoxItem item = TimeZonesDropDown.Items.FindItemByValue(value); if (item != null) { item.Selected = true; } } } #endregion protected void Page_Load(object sender, EventArgs e) { UpdateButton.ValidationGroup = Owner.ValidationGroup; UpdateButton.CommandName = Mode == RadSchedulerAdvancedFormAdvancedFormMode.Edit ? "Update" : "Insert"; if (Owner.AdvancedForm.EnableTimeZonesEditing) PopulateTimeZonesDropDown(); else TimeZonesDropDown.Visible = false; if (!Owner.Reminders.Enabled) ReminderDropDown.Visible = false; InitializeStrings(); InitializeRecurrenceEditor(); if (!FormInitialized) { // UpdateResetExceptionsVisibility(); } RadGrid1.DataBind(); } protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (!FormInitialized) { if (IsAllDayAppointment(Appointment)) { EndDate.SelectedDate = EndDate.SelectedDate.Value.AddDays(-1); } FormInitialized = true; } if (String.IsNullOrEmpty(Appointment.TimeZoneID)) TimeZoneID = Owner.TimeZonesProvider.OperationTimeZone.TimeZoneId; else TimeZoneID = Appointment.TimeZoneID; } private void PopulateTimeZonesDropDown() { TimeZonesDropDown.DataSource = Owner.TimeZonesProvider.GetAllTimeZones(); TimeZonesDropDown.DataTextField = "DisplayName"; TimeZonesDropDown.DataValueField = "Id"; } protected void BasicControlsPanel_DataBinding(object sender, EventArgs e) { AllDayEvent.Checked = IsAllDayAppointment(Appointment); } protected void DurationValidator_OnServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = (End - Start) > TimeSpan.Zero; } protected void ResetExceptions_OnClick(object sender, EventArgs e) { Owner.RemoveRecurrenceExceptions(Appointment); OriginalRecurrenceRule.Value = Appointment.RecurrenceRule; ResetExceptions.Text = Owner.Localization.AdvancedDone; } #region Private methods private void InitializeStrings() { SubjectValidator.ErrorMessage = Owner.Localization.AdvancedSubjectRequired; SubjectValidator.ValidationGroup = Owner.ValidationGroup; AllDayEvent.Text = Owner.Localization.AdvancedAllDayEvent; StartDateValidator.ErrorMessage = Owner.Localization.AdvancedStartDateRequired; StartDateValidator.ValidationGroup = Owner.ValidationGroup; StartTimeValidator.ErrorMessage = Owner.Localization.AdvancedStartTimeRequired; StartTimeValidator.ValidationGroup = Owner.ValidationGroup; EndDateValidator.ErrorMessage = Owner.Localization.AdvancedEndDateRequired; EndDateValidator.ValidationGroup = Owner.ValidationGroup; EndTimeValidator.ErrorMessage = Owner.Localization.AdvancedEndTimeRequired; EndTimeValidator.ValidationGroup = Owner.ValidationGroup; DurationValidator.ErrorMessage = Owner.Localization.AdvancedStartTimeBeforeEndTime; DurationValidator.ValidationGroup = Owner.ValidationGroup; ResetExceptions.Text = Owner.Localization.AdvancedReset; SharedCalendar.FastNavigationSettings.OkButtonCaption = Owner.Localization.AdvancedCalendarOK; SharedCalendar.FastNavigationSettings.CancelButtonCaption = Owner.Localization.AdvancedCalendarCancel; SharedCalendar.FastNavigationSettings.TodayButtonCaption = Owner.Localization.AdvancedCalendarToday; } private void InitializeRecurrenceEditor() { AppointmentRecurrenceEditor.SharedCalendar = SharedCalendar; AppointmentRecurrenceEditor.Culture = Owner.Culture; AppointmentRecurrenceEditor.StartDate = Appointment.Start; AppointmentRecurrenceEditor.EndDate = Appointment.End; } private void UpdateResetExceptionsVisibility() { // Render the reset exceptions checkbox when using web service binding if (string.IsNullOrEmpty(Owner.WebServiceSettings.Path)) { ResetExceptions.Visible = false; RecurrenceRule rrule; if (RecurrenceRule.TryParse(Appointment.RecurrenceRule, out rrule)) { ResetExceptions.Visible = rrule.Exceptions.Count > 0; } } } private bool IsAllDayAppointment(Appointment appointment) { DateTime displayStart = Owner.UtcToDisplay(appointment.Start); DateTime displayEnd = Owner.UtcToDisplay(appointment.End); return displayStart.CompareTo(displayStart.Date) == 0 && displayEnd.CompareTo(displayEnd.Date) == 0; } #endregion/** can ignore this.. just me testing how to get the value for patients **/
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e) { string KeyID = (RadGrid1.SelectedItems[0] as GridDataItem).GetDataKeyValue("Account_Number").ToString(); string name = (RadGrid1.SelectedItems[0] as GridDataItem)["FirstName"].Text.Trim() + " " + (RadGrid1.SelectedItems[0] as GridDataItem)["LastName"].Text.Trim(); (ResPatient.FindControl("ResourceValue") as RadComboBox).SelectedValue = KeyID; SubjectText.Text = name; SubjectText.ReadOnly = true; }}RadScheduler code:
<telerik:RadScheduler runat="server" ID="RadScheduler1" StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="True" Height="1000px" WorkDayEndTime="18:00:00" MinutesPerRow="15" SelectedView="WeekView" HoursPanelTimeFormat="t" GroupBy="Physician" ShowAllDayRow="False" OnClientAppointmentCreated="OnClientAppointmentCreated" OnClientAppointmentDoubleClick="hideTooltip" OnClientAppointmentContextMenu="hideTooltip" OnClientAppointmentClick="OnClientAppointmentClick" OnClientRequestSuccess="OnClientRequestSuccess" OnClientAppointmentsPopulating="OnClientAppointmentsPopulating" OnClientAppointmentContextMenuItemClicked="OnClientAppointmentContextMenuItemClicked" OnClientAppointmentEditing="OnClientAppointmentEditing" OnClientAppointmentMoveStart="OnClientAppointmentMoveStart"> <WebServiceSettings Path="Services/SchedulerWebService.asmx" ResourcePopulationMode="ServerSide" /> <AdvancedForm Modal="True" /> <AdvancedInsertTemplate> <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Patient='<%# Bind("Patient") %>' Facility='<%# Bind("Facility") %>' ApptType='<%# Bind("ApptType") %>' Physician='<%# Bind("Physician") %>' /> </AdvancedInsertTemplate> <TimeSlotContextMenus> <telerik:RadSchedulerContextMenu ID="SchedulerTimeSlotContextMenu" runat="server"> <Items> <telerik:RadMenuItem Text="New Appointment" Value="CommandAddAppointment" /> </Items> </telerik:RadSchedulerContextMenu> </TimeSlotContextMenus> <AppointmentContextMenus> <telerik:RadSchedulerContextMenu runat="server" ID="ContextMenu1"> <Items> <telerik:RadMenuItem Text="Edit" Value="CommandEdit" /> <telerik:RadMenuItem Text="Delete" Value="CommandDelete" /> <telerik:RadMenuItem IsSeparator="True" /> <telerik:RadMenuItem Text="Visit Details" Value="CommandDetails" /> </Items> </telerik:RadSchedulerContextMenu> </AppointmentContextMenus> <WeekView DayEndTime="17:00:00" DayStartTime="09:00:00" WorkDayStartTime="09:00:00" /> <DayView WorkDayEndTime="18:00:00" /> <MultiDayView WorkDayStartTime="09:00:00" /> <AppointmentContextMenuSettings EnableDefault="True" /> <TimeSlotContextMenuSettings EnableDefault="True" /> </telerik:RadScheduler> <telerik:RadToolTip ID="RadToolTip1" runat="server" RelativeTo="Element" Position="BottomCenter" AutoCloseDelay="0" ShowEvent="FromCode" Width="250px"> <div id="contentContainer" style="margin: 5px 5px 0px 5px; font-size: 12px; padding-bottom: 10px;"> <table> <tr> <td>Patient Name: <asp:Label ID="lblPatient" runat="server" Text="Test"></asp:Label> </td> </tr> <tr> <td>Appointment Type: <asp:Label ID="lblApptType" runat="server" Text=""></asp:Label> </td> </tr> <tr> <td>Scheduled Time: <asp:Label ID="lblTime" runat="server" Text=""></asp:Label> </td> </tr> <tr> <td>Provider: <asp:Label ID="lblProvider" runat="server" Text=""></asp:Label> </td> </tr> </table> <hr /> <table> <tr> <td>Description: <asp:Label ID="lbldesc" runat="server" Text="N/A"></asp:Label> </td> </tr> </table> </div> </telerik:RadToolTip> <telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Width="320" Height="170" Animation="None" HideEvent="Default" Text="Loading..." OnAjaxUpdate="RadToolTipManager1_AjaxUpdate"> </telerik:RadToolTipManager> <div style="display: none;"> </div> <asp:SqlDataSource ID="SqlDataSourceSchedResourceTypes" runat="server" ConnectionString="<%$ ConnectionStrings:kcMedic_Central_Connection %>" SelectCommand="sp_GetSchedulerResourceType" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter Name="siteid" SessionField="SiteId" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSourceSchedResourcFac" runat="server" ConnectionString="<%$ ConnectionStrings:kcMedic_Central_Connection %>" SelectCommand="sp_GetSchedulerResourceFacilities" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter Name="siteid" SessionField="SiteId" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSourceSchedResouPHYS" runat="server" ConnectionString="<%$ ConnectionStrings:kcMedic_Central_Connection %>" SelectCommand="sp_GetSchedulerResourcePhysicians" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter Name="siteid" SessionField="SiteId" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSourceSchedResourcePATs" runat="server" ConnectionString="<%$ ConnectionStrings:kcMedic_Central_Connection %>" SelectCommand="sp_GetSchedulerResourcePatients" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter Name="siteid" SessionField="SiteId" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSourceScheduler" runat="server" ConnectionString="<%$ ConnectionStrings:kcMedic_Central_Connection %>" SelectCommand="sp_GetSchedulerData" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter Name="siteid" SessionField="SiteId" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSourceAllPats" runat="server" ConnectionString="<%$ ConnectionStrings:kcMedic_Central_Connection %>" SelectCommand="sp_patientList" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:SessionParameter DefaultValue="C002" Name="SITE_ID_LNK" SessionField="SiteId" Type="String" /> </SelectParameters> </asp:SqlDataSource>