This is a migrated thread and some comments may be shown as answers.

How to pass value to appointment parameter

1 Answer 107 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
tcl4p
Top achievements
Rank 1
tcl4p asked on 01 May 2012, 03:00 PM
I have added a value (DeptID) to the appointment table which is not one of the Telerik appointment defined fields.  Since I already have the value available in a Session Variable I DO NOT want to have the user select the DeptID value from a drop down in advanced options dialog.  I have set up the datasource which includes the DeptID data field including using it in the select statement.  The data field shows up in the generated html code in both the insert statement and in the select statement as parameters.  What I can't find is how and where to value the parameter with the Session Variable.   So the question is what event and what syntax do I use to set the parameter @DeptID = Session["DeptID"].  As you can see I have set the DeptID as a custom attribute and have a select parameter for the DeptID including the Session Field to the DeptID.

Thanks,
Tom

 <telerik:RadScheduler ID="RadScheduler1" runat="server"
        CustomAttributeNames="DeptID"
        DataKeyField="ID"
        DataSubjectField="Subject"
        DataStartField="Start"
        DataEndField="End"
        DataDescriptionField="Description"
        DataRecurrenceField="RecurrenceRule"
        DataRecurrenceParentKeyField="RecurrenceParentID"
        DataSourceID ="SqlDataSource1"
        onappointmentdatabound="RadScheduler1_AppointmentDataBound" >
        <AdvancedForm />
        </telerik:RadScheduler>
       
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:crozetfdConnectionString %>"
            DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @original_ID"
            InsertCommand="INSERT INTO [Appointments] ([DeptID], [Subject], [Description], [Start], [End], [RecurrenceRule], [RecurrencePartentID], [Annotations]) VALUES (@DeptID, @Subject, @Description, @Start, @End, @RecurrenceRule, @RecurrencePartentID, @Annotations)"
            OldValuesParameterFormatString="original_{0}"
            SelectCommand="SELECT * FROM [Appointments] WHERE ([DeptID] = @DeptID)"
            
            UpdateCommand="UPDATE [Appointments] SET [DeptID] = @DeptID, [Subject] = @Subject, [Description] = @Description, [Start] = @Start, [End] = @End, [RecurrenceRule] = @RecurrenceRule, [RecurrencePartentID] = @RecurrencePartentID, [Annotations] = @Annotations WHERE [ID] = @original_ID">
            <DeleteParameters>
                <asp:Parameter Name="original_ID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="DeptID" Type="Int32" />
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrencePartentID" Type="Int32" />
                <asp:Parameter Name="Annotations" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:SessionParameter DefaultValue="" Name="DeptID" SessionField="DeptID" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="DeptID" Type="Int32" />
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrencePartentID" Type="Int32" />
                <asp:Parameter Name="Annotations" Type="String" />
                <asp:Parameter Name="original_ID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 02 May 2012, 01:35 PM
Hi Tom,

I hope someone in the forum community knows how to filter an SqlDataSource by SessionParameter and can help you with this requirement.

Have you considered using RadFilter as an alternative solution? Here is an online demo which might be helpful for your case - RadScheduler filtered by RadFilter.
 

All the best,
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.
Tags
Scheduler
Asked by
tcl4p
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or