search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Can't change TimeRangeSelectedHandling at runtime

Asked by Jimmie Andersson
16 years ago.

Hi!

I have some problem changing TimeRangeSelectedHandling server-side.

I'm using buttons outside the calendar to do things server-side, When I then try to set CallBack as Handling, nothing happens.

I'm updating the calendar like you guys helped me with before
http://forums.daypilot.org/Topic.aspx/355/cant_get_refreshcallback_to_work_in_aspnet_35

I'm running .NET 3.5

Changing date as in my example works great.
Below are my code attached.

Thank you very much.
Love this control!

Client-Side:

-----

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="tmpCalendar.aspx.cs" Inherits="tmpCalendar" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:ScriptManager runat="server" ID="ScriptMgr" EnablePartialRendering="true" EnableScriptGlobalization="true" />

<Daypilot:Daypilotcalendar
Id="dpcWeekCalendar"
ClientObjectName="dpc1"
runat="server"
ShowToolTip="false"
HeaderDateFormat="dddd d MMMM yyyy"
OnCommand="DpcWeekCalendar_Command"

OnTimeRangeSelected="DpcWeekCalendar_TimeRangeSelected"
TimeRangeSelectedHandling="CallBack"


/>

<a href="#" onclick="javascript:dpc1.commandCallBack();">Test (no update panel)</a>


<asp:UpdatePanel ID="uplPanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btnAdd" runat="server" OnClick="BtnAdd_Click" Text="Test (inside update panel)" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

-----

Server-Side:

-----

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DayPilot.Web.Ui.Events;
using DayPilot.Web.Ui.Events.Bubble;
using DayPilot.Web.Ui.Enums;

public partial class tmpCalendar : System.Web.UI.Page
{
private int FPNumDays
{
get { return (int)ViewState["numDays"]; }
set { ViewState["numDays"] = value; }
}

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.FPNumDays = 7;

dpcWeekCalendar.StartDate = DayPilot.Utils.Week.FirstDayOfWeek(DateTime.Today); ;
dpcWeekCalendar.Days = this.FPNumDays;
dpcWeekCalendar.TimeFormat = DayPilot.Web.Ui.Enums.TimeFormat.Clock24Hours;
dpcWeekCalendar.HeightSpec = DayPilot.Web.Ui.Enums.HeightSpecEnum.BusinessHours;
dpcWeekCalendar.DataBind();
}
}

protected void BtnAdd_Click(object sender, EventArgs e)
{
this.FPNumDays = 14;
ScriptManager.RegisterClientScriptBlock(uplPanel1, this.GetType(), "refresh", "javascript:window.setTimeout('dpc1.commandCallBack()', 100);", true);

}

protected void DpcWeekCalendar_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
{
dpcWeekCalendar.TimeRangeSelectedHandling = DayPilot.Web.Ui.Enums.TimeRangeSelectedHandling.Disabled;
dpcWeekCalendar.StartDate = dpcWeekCalendar.StartDate.AddDays(this.FPNumDays);
dpcWeekCalendar.Update(CallBackUpdateType.Full);

}

protected void DpcWeekCalendar_TimeRangeSelected(object sender, TimeRangeSelectedEventArgs e)
{

}
}

-----

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.