|
Rank: Newbie Groups: Member
Joined: 2/1/2010 Posts: 5
|
Hello ... I'm using a DatePicker along with a ProgressBar. In the ProgressBar1_RunTask I am calling a method to get the SelectedDate from the DatePicker .... no matter what date I choose I'm getting "01/01/0001" back.
Following is code snippet:
<eo:DatePicker runat="server" ID="fromDate" PickerFormat="MM/dd/yyyy" TitleRightArrowImageUrl="00040102" TitleLeftArrowImageUrl="00040101" TabIndex="2" DayHeaderFormat="Short" DayCellWidth="22" DayCellHeight="16" MonthSelectorVisible="True" WeekSelectorVisible="True" TitleLeftArrowDownImageUrl="00040103" TitleRightArrowDownImageUrl="00040104" Width="100px"> <SelectedDayStyle CssText="background-image:url('00040105');color:white;"></SelectedDayStyle> <TodayStyle CssText="background-image:url('00040106');"></TodayStyle> <DisabledDayStyle CssText="COLOR: gray"></DisabledDayStyle> <TitleStyle CssText="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; FONT-WEIGHT: bold; FONT-SIZE: 8pt; PADDING-BOTTOM: 3px; COLOR: white; PADDING-TOP: 3px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #0054e3"></TitleStyle> <CalendarStyle CssText="border-bottom-color:Black;border-bottom-style:solid;border-bottom-width:1px;border-left-color:Black;border-left-style:solid;border-left-width:1px;border-right-color:Black;border-right-style:solid;border-right-width:1px;border-top-color:Black;border-top-style:solid;border-top-width:1px;padding-bottom:5px;padding-left:5px;padding-right:5px;padding-top:5px;background-color:white"></CalendarStyle> <DayHoverStyle CssText="text-decoration:underline"></DayHoverStyle> <MonthStyle CssText="FONT-SIZE: 8pt; MARGIN: 0px 4px; FONT-FAMILY: Tahoma; cursor:hand"></MonthStyle> <FooterTemplate> <div style="FONT-WEIGHT: bold; FONT-SIZE: 11px; FONT-FAMILY: Tahoma""> <img src="{img:00040106}"> Today: {var:today:MM/dd/yyyy} </div> </FooterTemplate> <DayStyle CssText="text-decoration:none"></DayStyle> <DayHeaderStyle CssText="FONT-SIZE: 11px; COLOR: #0054e3; BORDER-BOTTOM: black 1px solid; FONT-FAMILY: Tahoma"></DayHeaderStyle> </eo:DatePicker>
Code behind:
protected void ProgressBar1_RunTask(object sender, EO.Web.ProgressTaskEventArgs e) { doStuff(); . . . . }
/* during debug hovering over fromData.SelectedDate gives me 01/01/0001 */ protected void doStuff() { string startDate = formatDate(fromDate.SelectedDate.ToShortDateString()); . . . }
Any help would be great ..... thanks ....
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, ProgressBar will only post back simple form values. In order to get the DatePicker value, you must trigger the progress bar with script and copy the date picker value into a hidden field before triggering the progress bar. It will be something like this:
Code: HTML/ASPX
<!-- This hidden field is used to transfer date picker value -->
<asp:HiddenField runat="server" ID="hiddenField1" />
<!-- This link is used to trigger the progress bar.
The progress bar's StartButton is NOT set -->
<a href="javascript:start_task()">Start Task</a>
Code: JavaScript
function start_task()
{
//Copy DatePicker value into hiddenField1
var selectedDate = eo_GetObject("DatePicker1").getSelectedDate();
var hiddenField =
document.getElementById("<%=hiddenField1.ClientID%>");
hiddenField.value = eo_DateToString(selectedDate);
//Start progress bar
eo_GetObject("ProgressBar1").startTask();
}
Code: C#
protected void ProgressBar1_RunTask(
object sender, EO.Web.ProgressTaskEventArgs e)
{
//Get the value from the hidden field
DateTime selectedDate =
EO.Web.Calendar.StringToDate(hiddenField1.Value);
....
}
Hope this helps. Thanks
|
|
Rank: Newbie Groups: Member
Joined: 2/1/2010 Posts: 5
|
Thanks .... I'll give it a try.
|
|