I have develop a Telerik Radscheduler in that i have write the code like below in that i want disable/Enable the perticuler time-slot for an event,in this disable is working fine but enable not working i can't understand why it is not enable to allow-insert.please help me where i need to change to resolve this problem...
protected void RadScheduler1_TimeSlotCreated1(object sender, TimeSlotCreatedEventArgs e)
{
//Getting Business hour time
mybusinesscalendarEntities objEntity = new mybusinesscalendarEntities();
var Result = from bhours in objEntity.businesshours where bhours.BusinessId == businessid select bhours;
if (Result.Count() > 0)
{
var Hours = (from bhours in objEntity.businesshours where bhours.BusinessId == businessid select bhours).First();
//Get particular day businee hour timings and disable the time slot
string Day = System.DateTime.Today.DayOfWeek.ToString();
if (Day == "Monday")
{
string WorkDay = Hours.MondayFromTime.Value.ToShortTimeString();
string WorkDayStart = WorkDay.Remove(WorkDay.Length - 2, 2);
string WorkDayEnd = Hours.MondayToTime.Value.ToShortTimeString();
string WorkDayEndTime = WorkDayEnd.Remove(WorkDayEnd.Length - 2, 2);
if ((e.TimeSlot.Start.TimeOfDay < TimeSpan.Parse(WorkDayStart.Trim())) || (e.TimeSlot.Start.TimeOfDay > TimeSpan.Parse(WorkDayEndTime.Trim())))
{
e.TimeSlot.CssClass = "Disabled";
RadScheduler1.ReadOnly = true;
}
else
{
RadScheduler1.ReadOnly = false;
RadScheduler1.AllowInsert = true;
RadScheduler1.AllowEdit = true;
RadScheduler1.AllowDelete = true;
}
If when your last timeslot is created (last time event is fired) this part evaluates to true.
Then your entire scheduler will be in read only mode. This means no editing inserting deleting moving etc.
Your intention seems to be to disabled specific timeslots. I dont think you intend to set these properties in this particular event.
Test by commenting out the lines that set the readonly, allowinster, allowedit, allowdelete properties since they are not per timeslot, rather for the entire scheduler