BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi
James,
Thanks
for your interest in Syncfusion products.
To
set the date of the DropDownCalendar control embedded in ToolBar items using
templates based on the selected items in toolbar, we suggest you to iterate the
available controls in the Toolbar and find the DropDownCalendar control using
the ID under ToolBar click event. Then you can set the date value for the
control as required using Value property. Please refer the following code
snippet,
<code>
[ASPX]
<syncfusion:ToolBar ID="tbDailySchedule_"
runat="server"
AutoFormat="Office2007
Blue" Width="100%"
OnClick="Toolbar_Click_"
Locked="True">
<Items>
<syncfusion:ToolBarItem ID="tbiDailySchedulePlus1Month_"
Text="+1
Month" ToolTip="Increase the report date by one month" AppearanceMode="TextOnly"
TextWrap="false"
/>
<syncfusion:ToolBarItem ID="tbiDailySchedulePlus1Week_"
Text="+1
Week" ToolTip="Increase the report date by one week" AppearanceMode="TextOnly"
TextWrap="false"
/>
<syncfusion:ToolBarItem ID="tbiDailySchedulePlus1Day_"
Text="+1 Day"
ToolTip="Increase
the report date by one day" AppearanceMode="TextOnly" TextWrap="false" />
<syncfusion:ToolBarItem ID="tbiDailyScheduleToday_"
Text="Today"
ToolTip="Reset the
report date to today's date" AppearanceMode="TextOnly" TextWrap="false" />
<syncfusion:ToolBarItem ID="tbiDailyScheduleMinus1Day_"
Text="-1 Day"
ToolTip="Decrease
the report date by one day" AppearanceMode="TextOnly" TextWrap="false" />
<syncfusion:ToolBarItem ID="tbiDailyScheduleMinus1Week_"
Text="-1
Week" ToolTip="Decrease the report date by one week" AppearanceMode="TextOnly"
TextWrap="false"
/>
<syncfusion:ToolBarItem ID="tbiDailyScheduleMinus1Month_"
Text="-1
Month" ToolTip="Decrease the report date by one month" AppearanceMode="TextOnly"
TextWrap="False"
/>
<syncfusion:ToolBarItem ID="tbiSelectDate_"
Text="Select
Date" ButtonType="DropDown" TemplateID="tbtcCSelectDate_" />
<syncfusion:ToolBarItem ID="tbiDailySchedulePrint_"
Text="Print/PDF"
ToolTip="Print the
information displayed" AppearanceMode="TextOnly" TextWrap="False" />
<syncfusion:ToolBarItem ID="tbiDailyScheduleReport_"
AppearanceMode="TextOnly"
Disabled="True"
Text="Report"
TextWrap="False"
ToolTip="Show the
Comprehensive Report page" Visible="False" />
</Items>
<Templates>
<syncfusion:ToolBarTemplateControl
ID="tbtcCSelectDate_"
runat="server"
ClientIDMode="Static">
<Template>
<syncfusion:DropDownCalendarControl
ID="ddccDateSelection_"
runat="server"
AutoPostBackOnValueChanged="True" OnValueChanged="ddccDateSelection_onValueChaged_" ClientSideOnValueChange="ShowWaitingPopup_()"
ClientIDMode="Static"
DayNameFormat="FirstLetter"
CustomFormat="dd
MMM yy" Format="CustomString" Width="100px" >
</syncfusion:DropDownCalendarControl>
</Template>
</syncfusion:ToolBarTemplateControl>
</Templates>
</syncfusion:ToolBar>
[CodeBehind]
protected void
Toolbar_Click_(object sender,
Syncfusion.Web.UI.WebControls.Tools.ToolBarControl.ToolBarCommandEventArgs
e)
{
foreach (Control
control in tbDailySchedule_.Controls[0].Controls)
{
if (control.ID == "ddccDateSelection_")
{
DropDownCalendarControl ddcl = (DropDownCalendarControl)control;
ddcl.CustomFormat = "MMM dd yyyy";
if (e.Item.ID == "tbiDailyScheduleToday_")
ddcl.Value = System.DateTime.Now;
if (e.Item.ID == "tbiDailyScheduleMinus1Day_")
ddcl.Value = System.DateTime.Now.AddDays(-1);
if (e.Item.ID == "tbiDailySchedulePlus1Day_")
ddcl.Value = System.DateTime.Now.AddDays(1);
if (e.Item.ID == "tbiDailySchedulePlus1Week_")
ddcl.Value = System.DateTime.Now.AddDays(7);
if (e.Item.ID == "tbiDailySchedulePlus1Month_")
ddcl.Value = System.DateTime.Now.AddMonths(1);
if (e.Item.ID == "tbiDailyScheduleMinus1Month_")
ddcl.Value = System.DateTime.Now.AddMonths(-1);
if (e.Item.ID == "tbiDailyScheduleMinus1Week_")
ddcl.Value = System.DateTime.Now.AddDays(-7);
}
}
}
</code>
For
your convenience we have modified your code to exhibit this behavior and it is
available in the following link,
http://www.syncfusion.com/downloads/support/directtrac/general/Toolbar_f1169301956036904.zip
Kindly
let us know if you have any other queries.
Regards,
Ezhil
S
Hi James,
Thanks for the update.
We are glad to know that provided solution resolved the
issue.
Hope we serve you better.
Kindly get back to us if you have further queries.
Regards,
Ezhil S