Welcome Guest Search | Active Topics | Sign In | Register

DatePicker Scroll not firing and DayRender causes error Options
dan thomas
Posted: Monday, October 13, 2008 8:02:16 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2008
Posts: 5
i'm trying to restrict the dates that can be selected in a DatePicker control

Rather than set the disabled dates for the next x years i want to set the disabled dates for just the current month and update each time a user scrolls to the next/previous month. i've added a handler to the Scroll method and set the AutoPostbackOnScroll to true but the handler isn't called.


.aspx:
Quote:
<%@ Page Language="C#" Trace="true" AutoEventWireup="true" CodeFile="EOCalendarTest.aspx.cs" Inherits="CalendarTest" %>
<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<eo:DatePicker ID="DatePicker1" runat="server" ControlSkinID="None"
DayCellHeight="16" DayCellWidth="19" DayHeaderFormat="FirstLetter"
SelectedDates=""
TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
TitleRightArrowImageUrl="DefaultSubMenuIcon"
PickerFormat="dd/MM/yyyy" AutoPostbackOnScroll="True"
onscroll="DatePicker1_Scroll">
<TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;" />
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
<TitleArrowStyle CssText="cursor:hand" />
<DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
<MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
</eo:DatePicker>
</div>
</form>
</body>
</html>


.cs
Quote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class CalendarTest : System.Web.UI.Page
{
protected void DatePicker1_Scroll(object sender, EventArgs e)
{
//Doesn't fire
DatePicker1.DisabledDates.Add(new DateTime(2008, 10, 1));
}
}


So i decided to use a DayRender handler to modify the appearance of each day but it causes the following message to be displayed when trying to scroll to a different month.

Quote:
EO.Web Controls Client Side Debug Message:

EO.Web control 'ctl03' error message:The callback on 'ctl03' has failed because the server did not recognize this callback and processed it as a normal request. This can occur if there are multiple Callback/CallbackPanel controls in the page, and this Callback/CallbackPanel control was initially dynamically loaded but wasn't loaded for this callback.

This can also occur if you have called Response.Redirect on the server side. Callback/CalbackPanel provides a Redirect method for such scenario. Please use the Callback/CallbackPanel's Redirect method in this case.(set ClientSideOnError to handle this error).

You can turn off this message by setting EO.Web.Runtime.DebugLevel to 0 (Not recommended for debug build).


Setting DebugLevel to 0 prevents the message from being shown but leaves the calendar control unresponsive.


.aspx:
Quote:
<%@ Page Language="C#" Trace="true" AutoEventWireup="true" CodeFile="EOCalendarTest.aspx.cs" Inherits="CalendarTest" %>
<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>
<!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></title>
<style type="text/css">
.otherMonth {
color: #999999;
}
.nonWorkingDay {
color: #FF0000;
}
.workingDay
{
font-weight: bold;
color: #009933;
}color: #999999;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<eo:DatePicker ID="DatePicker1" runat="server" ControlSkinID="None"
DayCellHeight="16" DayCellWidth="19" DayHeaderFormat="FirstLetter"
DisabledDates="" OtherMonthDayVisible="True" SelectedDates=""
TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
TitleRightArrowImageUrl="DefaultSubMenuIcon" VisibleDate="2008-10-01"
PickerFormat="dd/MM/yyyy" ondayrender="DatePicker1_DayRender">
<TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;" />
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
<TitleArrowStyle CssText="cursor:hand" />
<DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
<MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
</eo:DatePicker>
</div>
</form>
</body>
</html>


.cs:
Quote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class CalendarTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//EO.Web.Runtime.DebugLevel = 0;
}

public void DatePicker1_DayRender(object sender, EO.Web.DayRenderEventArgs e)
{
if (e.Day.IsOtherMonth)
{
e.Writer.Write("<span class='otherMonth'>{0}</span>", e.Day.DayNumberText);
}
else if (e.Day.IsWeekend || e.Day.DayNumberText.EndsWith("3"))
{
e.Day.IsSelectable = false;
e.Writer.Write("<span class='nonWorkingDay'>{0}</span>", e.Day.DayNumberText);
}
else
{
e.Writer.Write("<span class='workingDay'>{0}</span>", e.Day.DayNumberText);
}
}
}



am i doing something wrong?
eo_support
Posted: Monday, October 13, 2008 8:12:42 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The first problem (OnScroll not firing) is a bug that we have recently fixed. We are not sure about the second problem, but we tested on the latest version and it worked fine. So please try the latest version and let us know how it goes. If there are still problems, we can then start from there.

Please check your private messages for download location for the latest version.

Thanks
dan thomas
Posted: Monday, October 13, 2008 9:12:01 AM
Rank: Newbie
Groups: Member

Joined: 10/10/2008
Posts: 5
uninstalled 4.0, installed 4.2
the product version of all the (.net 2,0) eo.web.dll files on my machine is now 6.0.42.2
problems still the same
eo_support
Posted: Monday, October 13, 2008 9:34:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Dan,

Thanks for the update. Can you let us know:

1. Are both problem still the same?
2. Can you try whether OnScroll works on Calendar (instead of DatePicker)?

Thanks for your help!
eo_support
Posted: Tuesday, October 14, 2008 12:13:53 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We have looked further into this issue and noticed that OnScroll is not fired for DatePicker regardless whether AutoPostBackOnScroll is set. The reason is that when the page posts back, the whole page content is discarded and reloaded from the server. This means the whole client side DatePicker is also destroyed; this would cause the DatePicker to disappear from the page (including the drop down) and reappear. Thus OnScroll is specifically disabled for DatePicker. It does however work for Calendar.

Your scenario makes perfect sense though. So we will look into it and see whether we will be able to use AJAX call to update other DatePicker properties without recreating the DatePicker. Currently we only use AJAX to call DayRender event.

Hope this clears up.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.