The calendarextender control in the ajaxcontroltoolkit, developed based on ajax1.0, is mainly used to select dates. Generally, a text box is used. When the focus is obtained, the pop-up date panel is displayed. After the date is selected, the date is returned to the text box. This section briefly introduces the attributes and style settings of this control:
- Targetcontrolid
This property is used to set the control that gets the focus. The date panel is displayed and the date value is returned to this control. It is usually set to a text box.
- Format
This attribute is used to set the format of the returned date.
- Popupbuttonid
This property is used to set the control to be clicked. The date panel is displayed. This control does not grant the return value.
Example:
<ASP: scriptmanagerID= "Scriptmanager1"Runat= "Server">
</ASP: scriptmanager>
<Div>
<BR/> <BR/>
<B>Default calendar:</B>
<ASP: textboxID= "Data1"Runat= "Server"> </ASP: textbox>
<C0: calendarextenderID= "Calendarextender1"Runat= "Server"Targetcontrolid= "Data1">
</C0: calendarextender>
<B>Calendar with custom style and data format:</B> <BR/>
<ASP: textboxID= "Data2"Runat= "Server"> </ASP: textbox>
<C0: calendarextenderID= "Calendarextender2"Runat= "Server"Targetcontrolid= "Data2"Cssclass= "Mycalendar"Format= "Mm, D, YYYY">
</C0: calendarextender>
<BR/>
<BR/>
<B>Calendar with associated button:</B>
<ASP: textboxID= "Data3"Runat= "Server"> </ASP: textbox>
<ASP: ImageID= "Image1"Runat= "Server"Imageurl= "~ /Calendar_schedulehs.png" />
<C0: calendarextenderID= "Calendarextender3"Runat= "Server"Targetcontrolid= "Data3"Popupbuttonid= "Image1">
</C0: calendarextender>
About calendarextende style settings
In general, we always like to set controls through CSS style sheets. Setting control styles directly in Vs will only increase the load on the page, because the styles are directly written into HTML tags and output to the page, three controls with the same style mean to download three sets of CSS styles. If the style is applied to an external CSS file, the page performance can be greatly improved.
The following CSS file snippet points to the second calendarextender control in the previous example.MycalenderStyle Class. You can see from this. The style settings of the calendarextender subject are performed in the subclass Ajax _ calendar_container class. For other style settings, refer to the following:
. Mycalendar. Ajax _ calendar_container {} {
Border:1px solid #646464;
Background-color:Lemonchiffon;
Color:Red;
}
. Mycalendar. Ajax _ calendar_other. Ajax _ calendar_day,
. Mycalendar. Ajax _ calendar_other. Ajax _ calendar_year {} {
Color:Black;
}
. Mycalendar. Ajax _ calendar_hover. Ajax _ calendar_day,
. Mycalendar. Ajax _ calendar_hover. Ajax _ calendar_month,
. Mycalendar. Ajax _ calendar_hover. Ajax _ calendar_year {} {
Color:Black;
}
. Mycalendar. Ajax _ calendar_active. Ajax _ calendar_day,
. Mycalendar. Ajax _ calendar_active. Ajax _ calendar_month,
. Mycalendar. Ajax _ calendar_active. Ajax _ calendar_year {} {
Color:Black;
Font-weight:Bold;
}