我正在使用工作正常的 RadScheduler,但在选择复选框后我无法过滤约会,如果更改日历日期,也没有选择日期,如果我在问题上犯了错误,请提前感谢您的帮助
我的代码在这里
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI"%>
<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>ASP.NET scheduler examples | RadScheduler control demo</title>
<link href="Style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<script type="text/javascript">
//<![CDATA[
var categoryNames = new Array();
var scheduler = null;
var calendar1 = null;
var SchedulerNavigationCompleteAlreadyOccurred = false;
function pageLoad() {
scheduler = $find('<%=RadScheduler1.ClientID %>');
calendar1 = $find('<%=RadCalendar1.ClientID %>');
}
function rebindScheduler() {
var scheduler = $find('<%=RadScheduler1.ClientID %>');
scheduler.rebind();
}
function OnClientAppointmentsPopulating(sender, eventArgs) {
addSelectedCategoriesToArray(categoryNames);
eventArgs.get_schedulerInfo().CategoryNames = categoryNames;
categoryNames = new Array(); //clear the array
}
function addSelectedCategoriesToArray(categoryNamesArray) {
var $ = $telerik.$;
var categoryPanelBar = $find('<%=RadPanelBar1.ClientID %>');
$(':checkbox:checked', categoryPanelBar.get_element()).each(function () {
categoryNames.push($(this).attr('name'));
});
}
function OnClientAppointmentWebServiceInserting(sender, args) {
//set a default Calendar resource
if (args.get_appointment().get_resources().get_count() == 0) {
var defaultCalendarResource = sender.get_resources().getResourceByTypeAndKey("Calendar", 1);
args.get_appointment().get_resources().add(defaultCalendarResource);
}
}
function OnCalendar1DateSelected(sender, args) {
var scheduler = $find('<%=RadScheduler1.ClientID %>');
var selectedDateTriplet = sender.get_selectedDates()[0];
if (selectedDateTriplet) {
var selectedDate = new Date(selectedDateTriplet[0], selectedDateTriplet[1] - 1, selectedDateTriplet[2]);
scheduler.set_selectedDate(selectedDate);
}
}
function OnCalendar1ViewChanged(sender, eventArgs) {
var dateTriplet = sender.get_focusedDate();
if (!SchedulerNavigationCompleteAlreadyOccurred) {
var selectedDate = new Date(dateTriplet[0], dateTriplet[1] - 1, dateTriplet[2]);
scheduler.set_selectedDate(selectedDate);
}
SchedulerNavigationCompleteAlreadyOccurred = false;
}
function OnClientNavigationComplete(sender, args) {
SchedulerNavigationCompleteAlreadyOccurred = true;
var selectedDate = sender.get_selectedDate();
calendar1.navigateToDate([selectedDate.format("yyyy"), selectedDate.format("MM"), selectedDate.format("dd")]);
}
//]]>
</script>
<telerik:RadSplitter runat="server" ID="RadSplitter1" Skin="Sunset" PanesBorderSize="0"
Width="1000" Height="600">
<telerik:RadPane runat="Server" ID="leftPane" Width="220" Scrolling="None">
<telerik:RadSplitter runat="server" ID="RadSplitter2" Skin="Sunset" Orientation="Horizontal"
Width="100%">
<telerik:RadPane ID="RadPane1" runat="server" Width="220" Height="200">
<telerik:RadCalendar runat="server" ID="RadCalendar1" Skin="Metro" EnableMultiSelect="false"
DayNameFormat="FirstTwoLetters" EnableNavigation="true" EnableMonthYearFastNavigation="true">
<ClientEvents OnDateSelected="OnCalendar1DateSelected" OnCalendarViewChanged="OnCalendar1ViewChanged" />
</telerik:RadCalendar>
</telerik:RadPane>
<telerik:RadSplitBar ID="RadSplitBar1" runat="server" EnableResize="false" />
<telerik:RadPane ID="RadPane2" runat="server">
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" Skin="Sunset" Width="100%"
ExpandAnimation-Type="None" CollapseAnimation-Type="None" ExpandMode="SingleExpandedItem">
<Items>
<telerik:RadPanelItem runat="server" Text="My Calendars" Expanded="true">
<Items>
<telerik:RadPanelItem runat="server">
<ItemTemplate>
<div class="rpCheckBoxPanel">
<div class="qsf-chk-personal">
<label>
<input id="chkPersonal" type="checkbox" title="National Plans" onclick="rebindScheduler()"
value="National Plans" checked="checked" name="National Plans" />
<span>National Plans</span>
</label>
</div>
<div class="qsf-chk-work">
<label>
<input id="chkWork" type="checkbox" title="My Co-ops" onclick="rebindScheduler()"
value="My Co-ops" checked="checked" name="My Co-ops" />
<span>My Co-ops</span>
</label>
</div>
</div>
<telerik:RadButton runat="server" ID="Button1" Text="Group" OnClick="Button1_Click"
Icon-PrimaryIconCssClass="qsf-btn-group" />
<span title="This button Groups RadScheduler by its Resources creating a separate calendar for each resource item and situating the appropriate appointments there."
class="qsf-btn-hint">?</span>
</ItemTemplate>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelBar>
</telerik:RadPane>
</telerik:RadSplitter>
</telerik:RadPane>
<telerik:RadSplitBar runat="server" ID="RadSplitBar2" CollapseMode="Forward" EnableResize="false" />
<telerik:RadPane runat="Server" ID="rightPane" Scrolling="None">
<telerik:RadScheduler runat="server" ID="RadScheduler1" DataEndField="End" Skin="Vista"
DataKeyField="ID" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
DataSourceID="SchedulerDataSource" DataDescriptionField="Description" Height="700px"
DataStartField="Start" DataSubjectField="Subject" DayStartTime="08:00:00" DayEndTime="21:00:00"
FirstDayOfWeek="Monday" LastDayOfWeek="Friday" EnableDescriptionField="true"
AppointmentStyleMode="Default" OnClientAppointmentsPopulating="OnClientAppointmentsPopulating"
OnClientAppointmentWebServiceInserting="OnClientAppointmentWebServiceInserting"
OnClientNavigationComplete="OnClientNavigationComplete">
<%-- <WebServiceSettings Path="App_Code/SchedulerWebService.vb" ResourcePopulationMode="ServerSide" />--%>
<AdvancedForm Modal="true"></AdvancedForm>
<TimelineView UserSelectable="false"></TimelineView>
<ResourceTypes>
<telerik:ResourceType DataSourceID="RoomsDataSource" ForeignKeyField="RoomID" KeyField="ID"
Name="Room" TextField="RoomName" />
</ResourceTypes>
<ResourceStyles>
<%--AppointmentStyleMode must be explicitly set to Default (see above) otherwise setting BackColor/BorderColor
will switch the appointments to Simple rendering (no rounded corners and gradients)--%>
<telerik:ResourceStyleMapping Type="Room" Text="National Plans" ApplyCssClass="blue-border" />
<telerik:ResourceStyleMapping Type="Room" Text="My Co-ops" ApplyCssClass="green-border" />
</ResourceStyles>
<ResourceHeaderTemplate>
<div class="rsResourceHeader<%# Eval("Text") %>">
<%# Eval("Text")%>
</div>
</ResourceHeaderTemplate>
<TimeSlotContextMenuSettings EnableDefault="true" />
<AppointmentContextMenuSettings EnableDefault="true" />
<Localization HeaderWeek="Work week" />
</telerik: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" Skin="Windows7">
<AdvancedForm Modal="true"></AdvancedForm>
<TimelineView UserSelectable="false"></TimelineView>
<ResourceTypes>
<telerik:ResourceType DataSourceID="RoomsDataSource" ForeignKeyField="RoomID" KeyField="ID"
Name="Room" TextField="RoomName" />
</ResourceTypes>
<ResourceStyles>
<telerik:ResourceStyleMapping Type="Calendar" Text="VIP" BorderColor="#abd962" />
<telerik:ResourceStyleMapping Type="Calendar" Text="VVIP" BorderColor="#25a0da" />
</ResourceStyles>
<ResourceHeaderTemplate>
<div class="rsResourceHeader<%# Eval("Text") %>">
<%# Eval("Text") %>
</div>
</ResourceHeaderTemplate>
<TimeSlotContextMenuSettings EnableDefault="true" />
<AppointmentContextMenuSettings EnableDefault="true" />
<Localization HeaderWeek="Work week" />
</telerik:RadScheduler>--%>
</telerik:RadPane>
</telerik:RadSplitter>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<%--<telerik:AjaxSetting AjaxControlID="RadScheduler1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
</UpdatedControls>
</telerik:AjaxSetting>--%>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<asp:SqlDataSource ID="SchedulerDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SchedulerConnectionString %>"
DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @ID" InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [Description], [RoomID]) VALUES (@Subject, @Start, @End, @RecurrenceRule, @RecurrenceParentID, @Description, @RoomID)"
SelectCommand="SELECT [ID], [Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [Description], [RoomID] FROM [Appointments]"
UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Description] = @Description, [RoomID] = @RoomID WHERE [ID] = @ID">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<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="ID" Type="Int32" />
</UpdateParameters>
<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" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="RoomsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SchedulerConnectionString %>"
SelectCommand="SELECT [ID], [RoomName] FROM [Rooms]"></asp:SqlDataSource>
</form>
</body>
</html>