Because the Calendar Calendar control is a server control, you will sometimes see the error shown in Figure 10-1 if you want to include the server control in the runat= "Server" form, but only one of the pages contains a runat= "Server" form.
Figure 10-1 The page can have only one error containing the runat= "Server" form
What about it? Here is an embedded framework for the transfer.
10.1 Add Calendar Control
(1) Create a new blank asp.net vb dynamic page.
(2) Insert the runat= "Server" form and set id= "Calfrm".
(3) Click on the "More tags" button under the ASP.net shortcut menu, and select "ASP Calendar" under "asp.net tag" in the Pop-up Tag Selector dialog box, as shown in Figure 10-2.
Figure 10-2 Inserting the ASP Calendar tab
(4) Press the "Insert" button, pop-up "tag Editor-calendar" dialog box, as shown in Figure 10-3. In this dialog, you can set the style of the calendar control, which is not spoken here because it has Chinese.
(5) Save asp.net VB dynamic page for dkcalendar.aspx. Browse in IE, as shown in Figure 10-4.
Figure 10-3 "Tag Editor-calendar" dialog box
Figure 10-4 dkcalendar.aspx browsing in IE
In Figure 10-1-4, you can see that the week's display is too long, it's hard to see! If the display is "day, one or two, three or four, five or six", that's fine.
10.2 Change Calendar Week display
(1) Open dkcalendar.aspx in Dreamweaver, switch to Code view, and look for the following code:
Change it to:
(2) Click the "А:xy" button under the ASP.net shortcut menu to insert the namespace, as shown in Figure 10-5.
(3) Add new code at this time:
The input namespace is system.globalization, that is, the code should read:
(4) Add the namespace system.threading, and the result is shown in Figure 10-6.
Figure 10-5 Inserting a namespace
Figure 10-6 code after inserting a namespace
(5) in the code:
After that, empty a line and insert the following code:
(6) Select the original code for the Calendar control Calendar1, switch to the Properties tab of the tags panel, expand the Appearance option, select the Drop-down menu for the DayNameFormat item, and select Full, as shown in Figure 10-7.
(7) Save dkcalendar.aspx, browse in IE, the result is shown in Figure 10-8.
Figure 10-7 Selecting the "DayNameFormat" value of "full"
Figure 10-8 dkcalendar.aspx modified in IE browse
10.3 Adding calendar events
(1) Open dkcalendar.aspx in Dreamweaver, switch to Code view, select Calendar1 's original code, right-click it, and choose Edit Label (E) from the pop-up shortcut menu, as shown in Figure 10-9.
Figure 10-9 Select Edit label (E)
(2) in the pop-up "Edit label-calendar" dialog box, expand the Events item, select "OnSelectionChanged", in the "calendar-onselectionchanged" Event text area, enter "calendar1_ SelectionChanged, press the OK button, as shown in Figure 10-10.
Figure 10-10 Editing the OnSelectionChanged event