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>
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>