I am filtering a users resource based on the day, only showing the users that are available that day. On initial display, I get the non filtered resource just fine but I have to go in an load an appointment creation for each day to get each persons previously scheduled appointment.
I have this resource calling a stored procedure and if the default value of 0 is passed then it loads all employees so that should load take care of it does not work.
Any help
4 Answers, 1 is accepted
0
Hello mystrymaster,
Can you send us the code of your implementation?
Peter
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Can you send us the code of your implementation?
Peter
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Rick
Top achievements
Rank 1
answered on 13 Apr 2009, 02:02 PM
Here is the aspx page call to the scheduler
| <telerik:radscheduler runat="server" Width="797px" SelectedView="MonthView" id="appointmentScheduler" | |
| Height="570px" DataEndField="End" DataKeyField="appointmentId" DataSourceID="SqlDataSource1" | |
| DataStartField="Start" DataSubjectField="subject" OnFormCreating="schedulerMakeForm" | |
| StartInsertingInAdvancedForm="True" CustomAttributeNames="Entered" StartInFullTime="True" > | |
| <TimelineView UserSelectable="false" /> | |
| <AppointmentTemplate> | |
| <div class='empCalendar_<%# Eval("Event Type.Key")%>'> | |
| <%# Eval("Employee.Text") %> : <%# Eval("Event Type.Text")%> | |
| </div> | |
| </AppointmentTemplate> | |
| <resourcetypes> | |
| <telerik:ResourceType DataSourceID="SqlDataSource3" ForeignKeyField="typeId" | |
| KeyField="appointmentTypeId" Name="Event Type" TextField="typeName" /> | |
| <telerik:ResourceType DataSourceID="SqlDataSource4" ForeignKeyField="UserId" | |
| KeyField="UserId" Name="Employee" TextField="Employee" /> | |
| </resourcetypes> | |
| </telerik:radscheduler> | |
| <asp:SqlDataSource ID="SqlDataSource3" runat="server" | |
| ConnectionString="<%$ ConnectionStrings:myConnection %>" | |
| SelectCommand="SELECT [appointmentTypeId], [typeName] FROM [v2AppointmentTypes] ORDER BY [typeName]"> | |
| </asp:SqlDataSource> | |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" | |
| ConnectionString="<%$ ConnectionStrings:myConnection %>" | |
| SelectCommand="SELECT [appointmentId], [typeId], [Start], [End], [subject], [UserId] FROM [v2Appointment]" | |
| DeleteCommand="DELETE FROM [v2Appointment] WHERE [appointmentId] = @appointmentId" | |
| InsertCommand="INSERT INTO [v2Appointment] ([typeId], [Start], [End], [subject], [UserId]) VALUES (@typeId, @Start, @End, @subject, @UserId)" | |
| UpdateCommand="UPDATE [v2Appointment] SET [typeId] = @typeId, [Start] = @Start, [End] = @End, [subject] = @subject, [UserId] = @UserId WHERE [appointmentId] = @appointmentId"> | |
| <DeleteParameters> | |
| <asp:Parameter Name="appointmentId" Type="Int32" /> | |
| </DeleteParameters> | |
| <UpdateParameters> | |
| <asp:Parameter Name="typeId" Type="Int32" /> | |
| <asp:Parameter Name="Start" Type="DateTime" /> | |
| <asp:Parameter Name="End" Type="DateTime" /> | |
| <asp:Parameter Name="subject" Type="String" /> | |
| <asp:Parameter Name="UserId" /> | |
| <asp:Parameter Name="appointmentId" Type="Int32" /> | |
| </UpdateParameters> | |
| <InsertParameters> | |
| <asp:Parameter Name="typeId" Type="Int32" /> | |
| <asp:Parameter Name="Start" Type="DateTime" /> | |
| <asp:Parameter Name="End" Type="DateTime" /> | |
| <asp:Parameter Name="subject" Type="String" /> | |
| <asp:Parameter Name="UserId" /> | |
| </InsertParameters> | |
| </asp:SqlDataSource> | |
| <asp:SqlDataSource ID="SqlDataSource4" runat="server" | |
| ConnectionString="<%$ ConnectionStrings:myConnection %>" SelectCommand="v2proc_getEmployeesForMaster" SelectCommandType=StoredProcedure> | |
| <SelectParameters> | |
| <asp:Parameter Name="scheduleDay" DefaultValue="0"/> | |
| </SelectParameters> | |
| </asp:SqlDataSource> |
Here is the C# functions tied to it
| private void schedulerMakeForm(object sender, SchedulerFormCreatingEventArgs e) | |
| { | |
| helperFunctions theseFunctions = new helperFunctions(); | |
| DateTime date = e.Time; | |
| string thisDay = theseFunctions.getDayId(date.DayOfWeek.ToString()); | |
| rebindScheduler(thisDay); | |
| } | |
| private void rebindScheduler(string thisDay) | |
| { | |
| SqlDataSource4.SelectParameters[0].DefaultValue = thisDay; | |
| appointmentScheduler.Rebind(); | |
| } |
The stored Proc has an if else that if the passed day is 0, the default value, it then pulls back all the people that have a schedule.
0
Hi,
In the Optimized Queries demo we handle the Selecting event of the AppointmentsDataSource:
I suggest you follow this example and check if this helps.
Greetings,
Peter
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
In the Optimized Queries demo we handle the Selecting event of the AppointmentsDataSource:
| protected void AppointmentsDataSource_Selecting(object sender, SqlDataSourceSelectingEventArgs e) |
| { |
| if (CheckBox1.Checked) |
| { |
| e.Command.Parameters["@RangeStart"].Value = RadScheduler1.VisibleRangeStart; |
| e.Command.Parameters["@RangeEnd"].Value = RadScheduler1.VisibleRangeEnd; |
| } |
| } |
I suggest you follow this example and check if this helps.
Greetings,
Peter
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Rick
Top achievements
Rank 1
answered on 13 Apr 2009, 06:22 PM
Solved thanks