How to Use the calendar control and JS version in ASP. NET, asp. netjs
Today, editor will show you how to use the calendar control in ASP. NET as a task. The main task content is as follows:
1. Add a calendar, set the date to be displayed in the complete blue name, and the weekend to be displayed in yellow background red text, while the current date is displayed in green background, you can select one day, one week, or the entire month. The selected day, week, or month is displayed with a gray background color. After a date is selected, the time is displayed in the following text box. effect:
2. Design a registration page and use the js calendar control to help users enter the birth date. Effect:
Project 1 Calendar controls
1. Create a Calendar page under the site, drag and drop a TextBox Control on the page to enter the date, and a Calendar 1 Calendar control to set its properties, set the date to be displayed in blue, and the weekend to be displayed in yellow background red. The current date is displayed in green background. You can select one day, one week, or the entire month, the selected day, week, or month is displayed with a gray background color.
2. When the page is running, the SelectionChanged event is triggered when you select 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(); }}
Project 2. Js calendar controls
(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:
<Html xmlns = "http://www.w3.org/1999/xhtml">
(2) When you move the cursor over the TextBox control, it is activated to display the calendar
Run:
The above is all the content in this article. I hope you can learn how to use the calendar control in ASP. NET.