Today, we will take you to do the task of the form to understand the use of the Calendar control ASP, the main task content:
1, add a calendar, set the date in blue full name display, the weekend with yellow background red text display, and the current date with a green background display, the user can choose a day, a week or an entire month, the selected day/week/month with a gray background color to display. After a date is selected, the time is displayed in one of the following text boxes, with the effect:
2, design a registration page, using the JS Calendar control to help users enter the date of birth. Effect:
Learning Project A Calendar control
1, create a calendar page under the site, and drag and drop a TextBox control on the page to enter a date, a CALENDAR1 calendar control to set its properties, set the date to display the full name of Blue, the weekend with yellow background red text display, While the current date is displayed with a green background, the user can select a day, week, or whole month, and the selected day/week/month is displayed using a gray background color.
2. When the page is running, the SelectionChanged event is triggered when the user selects a date on the Calendar1 control. Write the following code in the Calendar.aspx.cs file:
protected void Calendar1_SelectionChanged (object sender, EventArgs e) { Textbox7.text = Calendar1.SelectedDate.ToString (); }}
Learning Item two JS Edition Calendar control
(1) Create a jscalendar.aspx page file under the site, add a TextBox control to the page, and write the following code in jscalendar.aspx.
(2) When you move the cursor over a TextBox control, it is activated to display the calendar
Run:
The above is the entire content of this article, I hope that you learn the ASP. NET in the use of the Calendar control method is helpful.