Hi,
I want to create a Scheduler with a color and location picker. The location list comes from my DB with an inline sql call to the DB. Also the RadScheduler has some inline sql calls to CRUD the calendar appointments. So I followed the example found at: http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx
I added my own datasource to the Room dropdown by altering the contents of ResourceControl.ascx to:
<asp:Label runat="server" ID="ResourceLabel" AssociatedControlID="ResourceValue" Text='<%# Label %>' CssClass="rsAdvResourceLabel" /><!--
--><telerik:RadComboBox runat="server" ID="ResourceValue" DataValueField="LCode" DataTextField="Location_Detail"
CssClass="rsAdvResourceValue" Skin='<%# Skin %>'
DataSourceID="SqlDataSource1" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:computershareConnectionString %>"
SelectCommand="SELECT * FROM [LocationsTable]">
</asp:SqlDataSource>
My RadScheduler control in the Default.aspx looks like this:
<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" Height="680px"
TimeZoneOffset="03:00:00"
OnDataBound="RadScheduler1_DataBound"
OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
OnClientFormCreated="schedulerFormCreated"
CustomAttributeNames="AppointmentColor"
EnableDescriptionField="True"
AppointmentStyleMode="Default" DataDescriptionField="Description"
DataEndField="EndTime" DataKeyField="ID" DataSourceID="SqlDataSource1"
DataStartField="StartTime" DataSubjectField="Subject">
<AdvancedForm Modal="true" />
<AppointmentTemplate>
<div class="rsAptSubject">
<%# Eval("Subject") %>
</div>
<%# Eval("Description") %>
</AppointmentTemplate>
<AdvancedEditTemplate>
<scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"
Subject='<%# Bind("Subject") %>'
Start='<%# Bind("StartTime") %>'
End='<%# Bind("End") %>'
Description='<%# Bind("Description") %>'
AppointmentColor='<%# Bind("AppointmentColor") %>'
RoomID='<%# Bind("Location_Code") %>' />
</AdvancedEditTemplate>
<AdvancedInsertTemplate>
<scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert"
Subject='<%# Bind("Subject") %>'
Start='<%# Bind("StartTime") %>'
End='<%# Bind("End") %>'
Description='<%# Bind("Description") %>'
AppointmentColor='<%# Bind("AppointmentColor") %>'
RoomID='<%# Bind("Location_Code") %>' />
</AdvancedInsertTemplate>
<TimelineView UserSelectable="false" />
<TimeSlotContextMenuSettings EnableDefault="true" />
<AppointmentContextMenuSettings EnableDefault="true" />
</telerik:RadScheduler>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:computershareConnectionString %>"
SelectCommand="SELECT * FROM [MyTable]"
DeleteCommand="DELETE FROM [MyTable] WHERE [ID] = @ID"
InsertCommand="INSERT INTO [MyTable] ([StartTime], [EndTime], [Subject], [Description], [Location_Code], [AppointmentColor]) VALUES (@StartTime, @EndTime, @Subject, @Description, @Location_Code, @AppointmentColor)"
UpdateCommand="UPDATE [MyTable] SET [StartTime] = @StartTime, [EndTime] = @EndTime, [Subject] = @Subject, [Description] = @Description, [Location_Code] = @Location_Code, [AppointmentColor] = @AppointmentColor WHERE [ID] = @ID">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="StartTime" Type="String" />
<asp:Parameter Name="EndTime" Type="String" />
<asp:Parameter Name="Subject" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Location_Code" Type="String" />
<asp:Parameter Name="AppointmentColor" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="StartTime" Type="String" />
<asp:Parameter Name="EndTime" Type="String" />
<asp:Parameter Name="Subject" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Location_Code" Type="String" />
<asp:Parameter Name="AppointmentColor" Type="String" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
If I remove the RoomID from AdvancedEditTemplate and AdvancedInsertTemplate the whole process works just fine but I'm missing the location. What is the problem? What am I doing wrong?
I also have to mention that LCode from [LocationTable] is the same as Location_Code from [MyTable].
Thanks.
I want to create a Scheduler with a color and location picker. The location list comes from my DB with an inline sql call to the DB. Also the RadScheduler has some inline sql calls to CRUD the calendar appointments. So I followed the example found at: http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx
I added my own datasource to the Room dropdown by altering the contents of ResourceControl.ascx to:
<asp:Label runat="server" ID="ResourceLabel" AssociatedControlID="ResourceValue" Text='<%# Label %>' CssClass="rsAdvResourceLabel" /><!--
--><telerik:RadComboBox runat="server" ID="ResourceValue" DataValueField="LCode" DataTextField="Location_Detail"
CssClass="rsAdvResourceValue" Skin='<%# Skin %>'
DataSourceID="SqlDataSource1" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:computershareConnectionString %>"
SelectCommand="SELECT * FROM [LocationsTable]">
</asp:SqlDataSource>
My RadScheduler control in the Default.aspx looks like this:
<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" Height="680px"
TimeZoneOffset="03:00:00"
OnDataBound="RadScheduler1_DataBound"
OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
OnClientFormCreated="schedulerFormCreated"
CustomAttributeNames="AppointmentColor"
EnableDescriptionField="True"
AppointmentStyleMode="Default" DataDescriptionField="Description"
DataEndField="EndTime" DataKeyField="ID" DataSourceID="SqlDataSource1"
DataStartField="StartTime" DataSubjectField="Subject">
<AdvancedForm Modal="true" />
<AppointmentTemplate>
<div class="rsAptSubject">
<%# Eval("Subject") %>
</div>
<%# Eval("Description") %>
</AppointmentTemplate>
<AdvancedEditTemplate>
<scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"
Subject='<%# Bind("Subject") %>'
Start='<%# Bind("StartTime") %>'
End='<%# Bind("End") %>'
Description='<%# Bind("Description") %>'
AppointmentColor='<%# Bind("AppointmentColor") %>'
RoomID='<%# Bind("Location_Code") %>' />
</AdvancedEditTemplate>
<AdvancedInsertTemplate>
<scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert"
Subject='<%# Bind("Subject") %>'
Start='<%# Bind("StartTime") %>'
End='<%# Bind("End") %>'
Description='<%# Bind("Description") %>'
AppointmentColor='<%# Bind("AppointmentColor") %>'
RoomID='<%# Bind("Location_Code") %>' />
</AdvancedInsertTemplate>
<TimelineView UserSelectable="false" />
<TimeSlotContextMenuSettings EnableDefault="true" />
<AppointmentContextMenuSettings EnableDefault="true" />
</telerik:RadScheduler>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:computershareConnectionString %>"
SelectCommand="SELECT * FROM [MyTable]"
DeleteCommand="DELETE FROM [MyTable] WHERE [ID] = @ID"
InsertCommand="INSERT INTO [MyTable] ([StartTime], [EndTime], [Subject], [Description], [Location_Code], [AppointmentColor]) VALUES (@StartTime, @EndTime, @Subject, @Description, @Location_Code, @AppointmentColor)"
UpdateCommand="UPDATE [MyTable] SET [StartTime] = @StartTime, [EndTime] = @EndTime, [Subject] = @Subject, [Description] = @Description, [Location_Code] = @Location_Code, [AppointmentColor] = @AppointmentColor WHERE [ID] = @ID">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="StartTime" Type="String" />
<asp:Parameter Name="EndTime" Type="String" />
<asp:Parameter Name="Subject" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Location_Code" Type="String" />
<asp:Parameter Name="AppointmentColor" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="StartTime" Type="String" />
<asp:Parameter Name="EndTime" Type="String" />
<asp:Parameter Name="Subject" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Location_Code" Type="String" />
<asp:Parameter Name="AppointmentColor" Type="String" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
If I remove the RoomID from AdvancedEditTemplate and AdvancedInsertTemplate the whole process works just fine but I'm missing the location. What is the problem? What am I doing wrong?
I also have to mention that LCode from [LocationTable] is the same as Location_Code from [MyTable].
Thanks.
