How to Use the calendar control and JS version in ASP. NET, asp. netjs

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.