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

[Solved] Disabling the Time Slot in Schedulre in Week View

5 Answers 270 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
yashaswi pk
Top achievements
Rank 1
yashaswi pk asked on 23 Feb 2010, 09:50 AM
How to disable each time slot in the scheduler in week view, I tried to disable it for a day, but the header only gets disabled. Not the time slot.
For eg:
I would like to disable all the time Slot of day which is sunday in week view. How do i do it.

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Feb 2010, 11:14 AM
Hi, Yashaswi,

If you want to prevent the user from adding new appointments for particlar day, then you can cancel the OnClientAppointmentInserting event using args.set_cancel(true) after checking the condition.

Client code:
 
    function OnClientAppointmentInserting(sender, args) { 
        if (condition) { // check for whether the clicked timeslot is sunday 
            args.set_cancel(true); 
        } 
    } 

Thanks,
Shinu.
0
yashaswi pk
Top achievements
Rank 1
answered on 23 Feb 2010, 11:21 AM
Thank you for your reply Shinu
But I want to do this from the code behind, as in my business case, their are several holidays for which i would liek to disable the time slot, or a particular time duration say from 10  AM to 12 AM of a particular day, or for the whole week also.
How to do the disable the Time slot for above mentioned scenario from code behind.

Thanks
Yashaswi
0
Peter
Telerik team
answered on 23 Feb 2010, 02:22 PM
Hi yashaswi pk,

The following kb article shows server side solution by handling TimeSlotCreated:

http://www.telerik.com/support/kb/aspnet-ajax/scheduler/setting-special-days-or-time-slots-in-radscheduler.aspx


Greetings,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
yashaswi pk
Top achievements
Rank 1
answered on 25 Feb 2010, 05:58 AM
Admin,
Thank you for the reply, that is what i was looking for. I have one more Issues related to the rad scheduler
I am  using the schedulre in the DNN
I am using external edit form for creating and editing the Appointment using the Raddock. I have placed asp.net validation controlsin the Raddock for vaildating the values enter in the textbox. Everything works fine in the week view. expect the Navingation.

Since i am using DNN, while navigating say, i clcik on the Todat link, then the URL gets binded with the # ange gets the actual URL path.

When i tried to find out the Issue, i came to know that, if i remove the validation controls, the navigation will not bind the #in the URl and the page gets loaded in the DNN.
It would be difficult to do a javascript validation as i have controls generated dynamicaly.

Please do let me know ehat has to be done for the navigation to work withou the # symbol being appended to the URL on redirecting in  DNN with the validation control in the external edit form.

I have also have pasted sample code in Asp.net  which shows the # sysmbol on reloading during click of navigation with the validation controls inside the RadDock.

Sample code is from link (http://www.telerik.com/support/kb/aspnet-ajax/scheduler/setting-special-days-or-time-slots-in-radscheduler.aspx) providede by you with changes only in the html page as below

<!--
Defaultvb.aspx

<

 

head id="Head1" runat="server">

 

 

<title>Untitled Page</title>

 

 

<style type="text/css">

 

 

.Disabled

 

{

 

background: gray;

 

 

cursor: not-allowed;

 

}

 

.Disabled.rsAptCreate

 

{

 

background: gray !important;

 

}

 

</style>

 

</

 

head>

 

<

 

body>

 

 

<form id="form1" runat="server">

 

 

<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" EnablePartialRendering="true"

 

 

runat="server">

 

 

</asp:ScriptManager>

 

 

<script type="text/javascript">

 

 

//Cancel OnClientAppointmentInserting if a time slot in a special day is double-clicked(insert is attempted).

 

 

function OnClientAppointmentInserting(sender, eventArgs) {

 

 

var slotElement = $telerik.$(eventArgs.get_targetSlot().get_domElement());

 

document.title += slotElement[0].className +

" ";

 

 

if (slotElement.is(".Disabled") || slotElement.parent().is(".Disabled")) {

 

 

// Prevent appointment inserting on holidays.

 

eventArgs.set_cancel(

true);

 

}

}

 

</script>

 

 

<asp:Panel ID="PanelMsg" runat="server">

 

 

<div id="divAppSucess" runat="server" visible="false" style="color: red">

 

Appointment has been created sucessfully.

</div>

 

 

<div id="divAppUpdateSucess" runat="server" visible="false" style="color: red">

 

Appointment details been updated sucessfully.

</div>

 

 

<div style="font-family: Verdana; color: Blue; font-size: small; height: 30px;">

 

Double click on the specific Time Slot to Create or View the Appointment

</div>

 

 

</asp:Panel>

 

 

<telerik:RadScheduler ID="RadScheduler1" runat="server" OnClientAppointmentInserting="OnClientAppointmentInserting"

 

 

SelectedView="WeekView" OnTimeSlotCreated="RadScheduler1_TimeSlotCreated" OnAppointmentUpdate="RadScheduler1_AppointmentUpdate"

 

 

SelectedDate="2008-06-26" DataEndField="End" DataKeyField="ID" DataStartField="Start"

 

 

DataSubjectField="Subject" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"

 

 

DataSourceID="AccessDataSource1" ColumnWidth="100px" ShowNavigationPane="False">

 

 

</telerik:RadScheduler>

 

 

<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/scheduler1.mdb"

 

 

DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = ?" InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [RoomID]) VALUES (?, ?, ?, ?, ?, ?)"

 

 

SelectCommand="SELECT * FROM [Appointments]" UpdateCommand="UPDATE [Appointments] SET [Subject] = ?, [Start] = ?, [End] = ?, [RecurrenceRule] = ?, [RecurrenceParentID] = ?, [RoomID] = ? WHERE [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="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="RoomID" Type="Int32" />

 

 

</InsertParameters>

 

 

</asp:AccessDataSource>

 

 

<telerik:RadDock runat="server" ID="RadDock1" Height="300px" Width="375px" Closed="true"

 

 

BackColor="#EEF3EF" Style="z-index: 2000;" Title="Appointment Schedules" >

 

 

<Commands>

 

 

<telerik:DockCloseCommand />

 

 

</Commands>

 

 

<ContentTemplate>

 

 

<div class="AppointEditForm">

 

 

<div class="header" style="display: none;">

 

 

<asp:Label runat="server" ID="StatusLabel"></asp:Label>

 

 

</div>

 

 

<div class="AppointInnercontent" style="margin-top: 20px;">

 

 

<div style="display: none;">

 

Time:

 

<asp:TextBox runat="server" ID="DescriptionText" Width="80px"></asp:TextBox>

 

Date:

 

<asp:TextBox runat="server" ID="DateText" Width="110px"></asp:TextBox>

 

 

</div>

 

 

<div style="text-align: center; height: 25px;">

 

 

<asp:Label runat="server" ID="Label1" Text="Appointment Date:"></asp:Label>

 

 

<asp:Label runat="server" ID="selDate" Text=""></asp:Label>

 

 

<table cellpadding="4" style="text-align: left;">

 

 

<div id="divRegistration" runat="server">

 

 

<div id="Login" runat="server" style="width: 100%">

 

 

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

 

 

<ContentTemplate>

 

 

<tr>

 

 

<td colspan="2">

 

 

<div>

 

Already a member, Login here

</div>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<asp:Label ID="lblUserName" runat="server" Text="User Name"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtUserName" ValidationGroup="login" runat="server"></asp:TextBox>

 

 

<asp:RequiredFieldValidator ID="rfusrname" runat="server" ControlToValidate="txtUserName"

 

 

Display="Dynamic" ErrorMessage="User Name Required" ValidationGroup="login" SetFocusOnError="true"></asp:RequiredFieldValidator>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<asp:Label ID="lblpass" runat="server" Text="Password"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtPass" runat="server" ValidationGroup="login" TextMode="Password"></asp:TextBox>

 

 

<asp:RequiredFieldValidator ID="rfpass" runat="server" ControlToValidate="txtPass"

 

 

Display="Dynamic" ErrorMessage="Password Required" ValidationGroup="login" SetFocusOnError="true"></asp:RequiredFieldValidator>

 

 

</td>

 

 

</tr>

 

 

</ContentTemplate>

 

 

<Triggers>

 

 

<asp:AsyncPostBackTrigger ControlID="btnLogin" EventName="Click" />

 

 

</Triggers>

 

 

</asp:UpdatePanel>

 

 

<tr>

 

 

<td>

 

 

</td>

 

 

<td>

 

 

<asp:Button ID="btnLogin" runat="server" ValidationGroup="login" Text="Login"></asp:Button>&nbsp;

 

 

</td>

 

 

</tr>

 

 

<hr />

 

 

</div>

 

 

<tr>

 

 

<td style="height: 25px;">

 

 

<asp:Label ID="lblstar1" runat="server" Text="*" ForeColor="red"></asp:Label>

 

 

<asp:Label ID="lblEmail" Width="140px" Text="Email(as User Name):" runat="server"

 

 

CssClass="Normal"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtemail" runat="server" CssClass="Normal" ValidationGroup="Reg"></asp:TextBox>

 

 

<asp:RequiredFieldValidator ID="rfemail" runat="server" ControlToValidate="txtemail"

 

 

ErrorMessage="Email is required" Display="Dynamic" SetFocusOnError="True" ValidationGroup="Reg"></asp:RequiredFieldValidator>

 

 

<asp:RegularExpressionValidator ID="reEmail" runat="server" ValidationGroup="Reg"

 

 

ControlToValidate="txtemail" SetFocusOnError="true" ErrorMessage="Valid Email Id"

 

 

ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"></asp:RegularExpressionValidator>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td style="height: 25px;">

 

 

<asp:Label ID="lblstar2" runat="server" Text="*" ForeColor="red"></asp:Label>

 

 

<asp:Label ID="lblFirstName" Width="140px" Text="First Name:" runat="server" CssClass="Normal"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtFirstName" runat="server" CssClass="Normal" ValidationGroup="Reg"></asp:TextBox>

 

 

<asp:RequiredFieldValidator ID="rfFirstName" runat="server" ValidationGroup="Reg"

 

 

ControlToValidate="txtFirstName" ErrorMessage="First name is required" Display="Dynamic"

 

 

SetFocusOnError="True"></asp:RequiredFieldValidator>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td style="height: 25px;">

 

 

<asp:Label ID="lblstar3" runat="server" Text="*" ForeColor="red"></asp:Label>

 

 

<asp:Label ID="lbllastName" Width="140px" Text="Last Name:" runat="server" CssClass="Normal"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtLastName" runat="server" CssClass="Normal" ValidationGroup="Reg"></asp:TextBox>

 

 

<asp:RequiredFieldValidator ID="rfLastName" runat="server" ControlToValidate="txtLastName"

 

 

ErrorMessage="Last name is required" Display="Dynamic" SetFocusOnError="True"

 

 

ValidationGroup="Reg"></asp:RequiredFieldValidator>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td style="height: 25px;">

 

 

<asp:Label ID="lblstar4" runat="server" Text="&nbsp;&nbsp;" ForeColor="red"></asp:Label>

 

 

<asp:Label ID="lbldisplayName" Width="140px" Text="Display Name:" runat="server"

 

 

CssClass="Normal"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtdisplayname" runat="server" CssClass="Normal" ValidationGroup="Reg"></asp:TextBox>

 

 

</td>

 

 

</tr>

 

 

<div id="divPassword" runat="server">

 

 

<tr>

 

 

<td style="height: 25px;">

 

 

<asp:Label ID="lblstar5" runat="server" Text="*" ForeColor="red"></asp:Label>

 

 

<asp:Label ID="lblpassword" Width="140px" Text="Password:" runat="server" CssClass="Normal"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtpassword" runat="server" CssClass="Normal" TextMode="Password"

 

 

ValidationGroup="Reg"></asp:TextBox>

 

 

<asp:RequiredFieldValidator ID="rfpassword" runat="server" ControlToValidate="txtpassword"

 

 

ErrorMessage="Password is required" Display="Dynamic" SetFocusOnError="True"

 

 

ValidationGroup="Reg"></asp:RequiredFieldValidator>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td style="height: 25px;">

 

 

<asp:Label ID="lblstar6" runat="server" Text="*" ForeColor="red"></asp:Label>

 

 

<asp:Label ID="lblconfpassword" Width="140px" Text="Confirm Password:" runat="server"

 

 

CssClass="Normal"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtconfpassword" runat="server" CssClass="Normal" TextMode="Password"

 

 

ValidationGroup="Reg"></asp:TextBox>

 

 

<asp:RequiredFieldValidator ID="rfconfpassword" runat="server" ControlToValidate="txtconfpassword"

 

 

ErrorMessage="Confirm Password is required" Display="Dynamic" SetFocusOnError="True"

 

 

ValidationGroup="Reg"></asp:RequiredFieldValidator>

 

 

<asp:CompareValidator ID="cmpPass" runat="server" ValidationGroup="Reg" ControlToValidate="txtconfpassword"

 

 

ControlToCompare="txtpassword" ErrorMessage="Password do not match" Display="Dynamic"

 

 

SetFocusOnError="True"></asp:CompareValidator>

 

 

</td>

 

 

</tr>

 

 

</div>

 

 

</div>

 

 

<tr>

 

 

<td style="width: 155px;">

 

 

&nbsp;&nbsp;<asp:Label ID="lblStartTime" runat="server" Text="Start Time:"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<telerik:RadDateTimePicker ID="StartTime" runat="server">

 

 

<TimeView ID="TimeView3" runat="server" StartTime="8:0:0" EndTime="20:59:59" Interval="0:30:0"

 

 

Columns="5" Culture="en-US">

 

 

</TimeView>

 

 

</telerik:RadDateTimePicker>

 

 

<asp:RequiredFieldValidator runat="server" ID="StartTimeRequiredFieldValidator" Display="Dynamic"

 

 

ControlToValidate="StartTime" ValidationGroup="Reg" ErrorMessage="Start time is required" />

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

&nbsp;&nbsp;<asp:Label ID="lblendTime" runat="server" Text="End Time:"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<telerik:RadDateTimePicker ID="EndTime" runat="server">

 

 

<TimeView ID="TimeView2" runat="server" StartTime="8:0:0" EndTime="20:59:59" Interval="0:30:0"

 

 

Columns="5" Culture="en-US">

 

 

</TimeView>

 

 

</telerik:RadDateTimePicker>

 

 

<asp:RequiredFieldValidator runat="server" ID="EndTimeRequiredFieldValidator" ValidationGroup="Reg"

 

 

Display="Dynamic" ControlToValidate="EndTime" ErrorMessage="End time is required" />

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<asp:Label ID="lbldescvalreq" runat="server" Text="*" ForeColor="red"></asp:Label>

 

 

<asp:Label ID="lblappdesc" runat="server" Text="Description:" CssClass="Normal"></asp:Label>

 

 

</td>

 

 

<td>

 

 

<asp:TextBox ID="txtappdesc" runat="server" ValidationGroup="Reg" CssClass="Normal"

 

 

TextMode="MultiLine"></asp:TextBox>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td colspan="2">

 

 

<div class="" style="float: left; height: auto; width: 100%">

 

 

<contenttemplate>

 

 

<asp:Label ID="lblAppId" runat="server" Visible="false" CssClass="Normal" />

 

 

<asp:PlaceHolder ID="PlaceHolder1" runat="server">

 

 

</asp:PlaceHolder>

 

 

<asp:DataList ID="dlRegCntrl" DataKeyField="AppColId" runat="server" CellPadding="1">

 

 

<ItemTemplate>

 

 

<table cellpadding="1" style="text-align:left;" width="100%" >

 

 

<tr>

 

 

<td valign="top" align="left" style="width:155px;text-align:left;">

 

 

<asp:Label ID="lblColmID" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "AppColId")%>'

 

 

Visible="false" CssClass="Normal" />

 

 

<asp:Label ID="lblstar" runat="server" Text="*" ForeColor="red"></asp:Label>

 

 

<asp:Label ID="lblContent" runat="server" Width="110px" Text='<%#DataBinder.Eval(Container.DataItem, "ColName")+ ":" %>'

 

 

CssClass="Normal" />

 

 

</td>

 

 

<td>

 

 

<asp:DropDownList ID="drpCntrl" runat="server" Width="137px" CssClass="Normal" ValidationGroup="Reg"

 

 

Visible="false">

 

 

</asp:DropDownList>

 

 

<asp:TextBox ID="txtCntl" runat="server" CssClass="Normal" ValidationGroup="Reg"></asp:TextBox>

 

 

<asp:RequiredFieldValidator ID="rfCntrl" runat="server" ControlToValidate="txtCntl"

 

 

ErrorMessage="Field Required" ValidationGroup="Reg" SetFocusOnError="true">

 

 

</asp:RequiredFieldValidator>

 

 

<asp:RegularExpressionValidator ID="reEmailid" runat="server" ValidationGroup="Reg"

 

 

ControlToValidate="txtCntl" SetFocusOnError="true" ErrorMessage="Valid Email Id"

 

 

ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic">

 

 

</asp:RegularExpressionValidator>

 

 

<asp:RegularExpressionValidator ID="reNumber" runat="server" ControlToValidate="txtCntl"

 

 

Display="Dynamic" ErrorMessage="Numeric and Max 12" SetFocusOnError="True"

 

 

ValidationExpression="^\d{0,12}?$" ValidationGroup="Reg" Visible="false"></asp:RegularExpressionValidator>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</ItemTemplate>

 

 

</asp:DataList>

 

 

</contenttemplate>

 

 

</div>

 

 

<div id="divAppStatus" runat="server" visible="false">

 

 

<asp:CheckBox ID="chkCompleted" runat="server" TextAlign="Right" Text="Appointment Completed" />

 

 

</div>

 

 

<div style="clear: both; height: 20px; text-align: center;">

 

 

<asp:Button runat="server" ID="SubmitButton" Text="Submit" ValidationGroup="Reg"

 

 

CssClass="Green_button_large15c" />&nbsp;&nbsp;

 

 

<button onclick="hideForm();" type="button" style="margin-right: 0px;" class="Green_button_large15c">

 

Cancel

</button>

 

 

</div>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</div>

 

 

</div>

 

 

</div>

 

 

<div style="height: 80px; width: 350px; padding-left: 5px; margin-top: 100px; text-align: center;">

 

 

<asp:Label runat="server" ID="lblMesgs" CssClass="AppointMsgStyle">Appointment cannot be scheduled for previous Datetime.</asp:Label>

 

 

</div>

 

 

<div style="text-align: center;">

 

 

<button onclick="hideForm();" type="button" style="margin-right: 20px;" class="Green_button_large15c">

 

Ok

</button>

 

 

</div>

 

 

</ContentTemplate>

 

 

</telerik:RadDock>

 

 

</form>

 

</

 

body>

 

</

 

html>

 


Default.aspx.vb


 

Private ReadOnly SpecialDays As DateTime() = New DateTime() {New DateTime(2008, 6, 26), New DateTime(2008, 6, 27)}

 

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

 

 

End Sub

 

 

Protected Sub RadScheduler1_TimeSlotCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.TimeSlotCreatedEventArgs)

 

 

For Each dt As DateTime In SpecialDays

 

 

If DateTime.Compare(e.TimeSlot.Start.[Date], dt) = 0 Then

 

 

'Set the CssClass property to visually distinguish your special days.

 

e.TimeSlot.CssClass =

"Disabled"

 

 

End If

 

 

Next

 

 

End Sub

 

 

Protected Sub RadScheduler1_AppointmentUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentUpdateEventArgs)

 

 

For Each dt As DateTime In SpecialDays

 

 

If (DateTime.Compare(e.ModifiedAppointment.Start.[Date], dt) = 0) OrElse (DateTime.Compare(e.ModifiedAppointment.[End].[Date], dt) = 0) Then

 

e.Cancel =

True

 

 

End If

 

 

Next

 

 

End Sub

-->

 



0
Peter
Telerik team
answered on 03 Mar 2010, 01:43 PM
Hi yashaswi,

Can you open a support ticket and send us your RadScheduler module so we can test it locally?


Best wishes,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Scheduler
Asked by
yashaswi pk
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
yashaswi pk
Top achievements
Rank 1
Peter
Telerik team
Share this question
or