Use the ASP. NET Ajax-popupcontrol Control

Source: Internet
Author: User
Document directory
  • Introduction
  • Important attributes
  • Instance
Introduction

Popupcontrol can pop up any type of controls, whether on the server control or HTML control. When a control obtains the focus, another control is displayed. After some operations are performed, the displayed control is hidden.

Important attributes

Targetcontrolid: ID of the control to be popped up
Popupcontrolid: ID of the pop-up control
Position: the position of the pop-up control
Offsetx/offsety: The relative coordinates of the pop-up control and the default position

Instance

1. Open vs2005 and create an ajaxcontroltoolkit website named ajaxpopupcontrol.
2. Open the default. ASPX page generated by default and switch to the design view of the form.
3. Drag an updatepanel, popupcontrolextender, Textbox, and calendar control on the page.
4. Set the attributes of the popupcontrolextender control. The calendar control is displayed on the right side of the popupcontrolextender control when the focus is obtained.

<ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server"                  TargetControlID="TextBox1" PopupControlID="Calendar1" Position="right"></ajaxToolkit:PopupControlExtender>

5. Add code to the selectionchanged event of the calendar control so that the selected date can be displayed in the text box after the date is selected, as shown below:

protected void Calendar1_SelectionChanged(object sender, EventArgs e){    this.TextBox1.Text = this.Calendar1.SelectedDate.ToShortDateString();}

6. Save the design and run the program. When you click the text box, the calendar control is displayed on the right of the text box. Select a date and the date will be displayed in the text box.

Related Article

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.