Welcome Guest Search | Active Topics | Sign In | Register

Output from Calendar - NOT date picker Options
Alex in Codeland
Posted: Wednesday, April 13, 2011 9:54:39 AM
Rank: Newbie
Groups: Member

Joined: 4/13/2011
Posts: 7
I am using a multi calendar display, but I want to change a label text value to the date selected OR if a week is selected, refresh the other splitter panel's content.

Normally I programme in C# and I am starting to think I am mixing my JavaScript with C# - but I cannot get either to work, nor can I find any samples that select the date from a calendar display rather than a date picker.

Is what I am trying to achieve possible?

TIA for any help
eo_support
Posted: Wednesday, April 13, 2011 10:35:07 AM
Rank: Administration
Groups: Administration

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

If you wish to do it on the server side, you will need to set the Calendar's AutoPostBackOnSelect to true and handle the Calendar's SelectionChanged event. If you wish to do it on the client side, you will need to handle the Calendar's ClientSideOnSelect event.

If you have never used our client side interface before, you will want to take a look of this topic first:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

Thanks!
Alex in Codeland
Posted: Wednesday, April 13, 2011 11:03:03 AM
Rank: Newbie
Groups: Member

Joined: 4/13/2011
Posts: 7
I think I have all of that in hand. For this particular function it will be server side as I need to make a new trip to the database depending on the date selected.

This is my calendar setup;

<eo:Calendar ID="Calendar1" runat="server" ControlSkinID="None"
DayCellHeight="20" DayCellWidth="25" DayHeaderFormat="Short" DisabledDates=""
MonthColumns="1" MonthRows="3"
OtherMonthDayVisible="False" SelectedDates=""
TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
TitleRightArrowImageUrl="DefaultSubMenuIcon"
ToolTip="Select a day to input your activities or a week to input leave" VisibleDate="2011-04-01"
WeekSelectorHtml="&gt;&amp;nbsp;" WeekSelectorVisible="True"
AbbreviatedDayNames="S,M,T,W,T,F,S" AutoPostbackOnSelect="True">
<CalendarStyle CssText="background-color:white;border-bottom-color:Silver;border-bottom-style:solid;border-bottom-width:1px;border-left-color:Silver;border-left-style:solid;border-left-width:1px;border-right-color:Silver;border-right-style:solid;border-right-width:1px;border-top-color:Silver;border-top-style:solid;border-top-width:1px;color:#2C0B1E;padding-bottom:5px;padding-left:5px;padding-right:5px;padding-top:5px; font-family: Verdana; font-size: .8em;" />
<TitleStyle CssText="font-family:Verdana;font-size:8.75pt;padding-bottom:5px;padding-left:5px;padding-right:5px;padding-top:5px; background-color:#999999" />
<TitleArrowStyle CssText="cursor: hand" />
<MonthStyle CssText="cursor:hand;margin-bottom:0px;margin-left:4px;margin-right:4px;margin-top:0px;" />
<DayHeaderStyle CssText="font-family:Verdana;font-size:8pt;padding-bottom:8px;font-weight:bold; border-bottom: #999999 1.5px solid" />
<DayStyle CssText="margin-top:5px;font-family:Verdana;font-size:8pt;" />
<DayHoverStyle CssText="margin-top:5px;font-family:Verdana;font-size:8pt;background-image:url('00040402');color:#94bdf2;" />
<TodayStyle CssText="font-family:Verdana;font-size:8pt;background-image:url('00040402');color:#94bdf2;" />
<SelectedDayStyle CssText="margin-top:5px;font-family:Verdana;font-size:8pt;font-weight:bold;background-image:url('00040402');color:94bdf2;" />
<DisabledDayStyle CssText="font-family:Verdana;font-size:8pt;color: gray" />
</eo:Calendar>

and this is my code behind;

protected void Calendar1_SelectionChanged (object sender, EventArgs e)
{
Label2.Text = Calendar1.SelectedDate.ToShortDateString();
}

But I am not getting anything input into my label.

What have I done wrong?
eo_support
Posted: Wednesday, April 13, 2011 11:14:09 AM
Rank: Administration
Groups: Administration

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

We tested your code and it works fine. So you may want to try it in a blank page and get it working there first. After that you can try to compare the working page and non-working page to see what triggers your problem. As far as from the Calendar's concern, it's working fine.

Thanks!
Alex in Codeland
Posted: Wednesday, April 13, 2011 12:35:05 PM
Rank: Newbie
Groups: Member

Joined: 4/13/2011
Posts: 7
Ah HA! Funny but on my blank page, it doesn't do a thing when I put the code in Calendar1_SelectionChanged BUT works a treat when I changed it to;

protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack) { Label2.Text = Calendar1.SelectedDate.ToShortDateString(); }
}

Any idea why?
eo_support
Posted: Wednesday, April 13, 2011 12:39:28 PM
Rank: Administration
Groups: Administration

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

We don't troubleshoot errors in your application. We tested in a blank page and it works. So you will want to get that working first. Make sure you do not have anything else in your project (for example, do not include a master page). If that still does not work, try to create a test project with nothing else but a blank test page with the above code to demonstrate the problem and send it to us, we will be happy to take a look once we have that.

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.