RadScheduler Help

4 posts, 0 answers
  1. S
    S avatar
    2 posts
    Member since:
    Aug 2012

    Posted 17 Aug 2012 Link to this post

    I am working on RadScheduler

    <telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="End" DataKeyField="ID"
            DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
            DataSourceID="SchedulerDataSource" DataDescriptionField="Description" Height="700px"
            DataStartField="Start" DataSubjectField="Subject" EnableEmbeddedSkins="true"
            Skin="Windows7" OnAppointmentCreated="RadScheduler1_AppointmentCreated" AdvancedForm-Enabled="true"
            OnAppointmentDataBound="RadScheduler1_AppointmentDataBound1" OnDataBound="RadScheduler1_DataBound"
            StartInsertingInAdvancedForm="true">
            <AppointmentContextMenuSettings EnableDefault="true" />
            <AdvancedForm Modal="true" />
            <TimelineView UserSelectable="false" />
            <ResourceTypes>
                <telerik:ResourceType DataSourceID="RoomsDataSource" ForeignKeyField="RoomID" KeyField="ID"
                    Name="Room" TextField="RoomName" />
                <telerik:ResourceType DataSourceID="DocDataSource" ForeignKeyField="DoctorID" KeyField="UID"
                    Name="DoctorName" TextField="first_name" />
                <telerik:ResourceType DataSourceID="PatientDataSource" ForeignKeyField="PatientID"
                    KeyField="UID" Name="PatientName" TextField="FullName" />
                <telerik:ResourceType DataSourceID="TypeDataSource" ForeignKeyField="TypeID" KeyField="UID"
                    Name="Type" TextField="UtilityValue" />
                <telerik:ResourceType DataSourceID="SqlClinic" ForeignKeyField="CompanyId" KeyField="CompanyId"
                    Name="Clinic" TextField="CompanyName" />
            </ResourceTypes>
            <ResourceStyles>
                <telerik:ResourceStyleMapping Text="DoctorName" BackColor="Chocolate" />
            </ResourceStyles>
            <AppointmentTemplate>
                <div>
                    <asp:Panel ID="RecurrencePanel" CssClass="rsAptRecurrence" runat="server" Visible="false" />
                    <asp:Panel ID="RecurrenceExceptionPanel" CssClass="rsAptRecurrenceException" runat="server"
                        Visible="false" />
                    <asp:Panel ID="ReminderPanel" CssClass="rsAptReminder" runat="server" Visible="false" />
                    <%#Eval("Subject") %>

                </div>
                <hr />
                <div>
                Test: <strong>
                        <%#Container.Appointment.Resources.GetResourceByType("DoctorName").Text%>
                    </strong>
                <br />
                    Doctor: <strong>
                        <%#Container.Appointment.Resources.GetResourceByType("DoctorName").Text%>
                    </strong>
                    <br />
                    Patient: <strong>
                        <%#Container.Appointment.Resources.GetResourceByType("PatientName").Text%>
                    </strong>
                    <br />
                    Room: <strong>
                        <%#Container.Appointment.Resources.GetResourceByType("Room").Text%>
                    </strong>
                    <br />
                    Type: <strong>
                        <%#Container.Appointment.Resources.GetResourceByType("Type").Text%>
                    </strong>
                    <br />
                    Clinic : <strong>
                        <%#Container.Appointment.Resources.GetResourceByType("Clinic").Text%>
                    </strong>
                    <br />
                    
                </div>
            </AppointmentTemplate>

        </telerik:RadScheduler>
        <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" OnAjaxUpdate="RadToolTipManager1_AjaxUpdate">
        </telerik:RadToolTipManager>
        <asp:SqlDataSource ID="SchedulerDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            DeleteCommand="DeleteAppointments" DeleteCommandType="StoredProcedure" InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [Description], [RoomID],[DoctorID],[PatientID],[TypeID],[CompanyId]) VALUES (@Subject, @Start, @End, @RecurrenceRule, @RecurrenceParentID, @Description, @RoomID,@DoctorID,@PatientID,@TypeID,@CompanyId) select @@Identity"
            SelectCommand="SearchAppointmentsDefault" SelectCommandType="StoredProcedure"
            UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Description] = @Description, [RoomID] = @RoomID,[DoctorID]=@DoctorID,[PatientID]=@PatientID, [TypeID]=@TypeID,[CompanyId]=@CompanyId WHERE [ID] = @ID">
            <InsertParameters>
                <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="Int32" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="RoomID" Type="Int32" />
                <asp:Parameter Name="DoctorID" Type="Int32" />
                <asp:Parameter Name="PatientID" Type="Int32" />
                <asp:Parameter Name="TypeID" Type="Int32" />
                <asp:Parameter Name="CompanyId" Type="Int32" />
            </InsertParameters>
            <DeleteParameters>
                <asp:Parameter Name="AuditId" Type="Int64" />
                <asp:Parameter Name="ID" Type="Int64" />
            </DeleteParameters>
        </asp:SqlDataSource>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <asp:SqlDataSource ID="RoomsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [ID], [RoomName] FROM [Rooms]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="DocDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [UID], [first_name] FROM [Teacher]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="PatientDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SelectPatients" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="TypeDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="SELECT [UID], [UtilityValue] from [utility] where utilityGroup='Type'">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDoctor" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="GetTeacherInfoForScheduler" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:Parameter Name="companyId" Type="string" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlClinic" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="getCompanies" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:Parameter Name="Company" Type="string" />
            </SelectParameters>
        </asp:SqlDataSource>


    by using this I can able to get the patients names but they are loading in dropdown,
    <telerik:ResourceType DataSourceID="PatientDataSource" ForeignKeyField="PatientID"
                    KeyField="UID" Name="PatientName" TextField="FullName" />

    There are 4000 patients. The DropDown does not allow text based searches. Users must scroll through thousands of patients to find the one they are looking for.

    Is there a control, such as autocompletefield, which better fits my needs?

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 21 Aug 2012 Link to this post

    Hi,

    You can customize the advanced form using the advance templates as shown in this demo and replace RadComboBox in the ResourceControl user control with the new RadAutoCompleteBox.

    Kind regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Ramya
    Ramya avatar
    4 posts
    Member since:
    Oct 2012

    Posted 12 Sep 2012 Link to this post

    Hi,
    Iam using rad scheduler in one of my projects. I am using advancedinsert template and a user control in the insert template. When i save the event on clicking save button from user control , event gets added to database but i get an exception
    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:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Telerik.Web.UI.RadScheduler.InsertAppointmentInline() +79
       Telerik.Web.UI.RadScheduler.OnBubbleEvent(Object source, EventArgs args) +483
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
    

    The rad scheduler is as below
    <telerik:RadScheduler runat="server" ID="RegScheduler" CssClass="RegScheduler"
                SelectedView="MonthView" AllowDelete="false" AppointmentStyleMode="Default"
                TimelineView-UserSelectable="false" CustomAttributeNames="EventStatus"
                  StartInsertingInAdvancedForm="True"     
                EnableCustomAttributeEditing="True"  EnableExactTimeRendering="True"  StartEditingInAdvancedForm="true"
                EnableResourceEditing="False"   AdvancedForm-EnableCustomAttributeEditing="True"  
                OnClientAppointmentsPopulating="appointmentsPopulating" OnClientAppointmentsPopulated="appointmentsPopulated"           
                OnClientDataBound="clientDataBound"
                AllowEdit='<%# AllowCalendarEventEditing %>'   
                AllowInsert='<%# AllowCalendarEventEditing %>'>
                <AdvancedForm Modal="true" />          
                <WebServiceSettings Path="Controls/Registration/Calendar/SchedulerWcfService.svc" />
                <AdvancedEditTemplate>
                <uc2:ManageEvent runat="server" ID="AdvancedEditForm1" Mode="Edit" SelectedCompanies='<%# SelectedCompanies %>' CalendarMode='<%# CalendarMode %>' CurrentTimeZone='<%# CurrentTimeZone %>' />
                </AdvancedEditTemplate>

                <AdvancedInsertTemplate>
                 <uc2:ManageEvent runat="server"  ID="AdvancedInsertForm1" Mode="Insert" SelectedCompanies='<%# SelectedCompanies %>' CalendarMode='<%# CalendarMode %>' CurrentTimeZone='<%# CurrentTimeZone %>' StartDateTime='<%# Bind("Start") %>' EndDateTime='<%# Bind("End") %>' />
                </AdvancedInsertTemplate>

    But when i reload the calendar i see the event added. can you please advice on what to look at?
    How can i avoid the exception?

    Thanks
    Ramya
  4. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 13 Sep 2012 Link to this post

    Hi Ramya,

    The following code library project contains a scenario just like yours: http://www.telerik.com/community/code-library/aspnet-ajax/scheduler/customize-the-advanced-form-with-the-advanced-template-user-controls.aspx.

    The online demo linked below shows your scenario as well: http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx.

    Regards,
    Ivana
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top