Asp.net custom control development for Alibaba Cloud (1)-swordsman

Source: Internet
Author: User

  • 1. Introduction

  After five months of work, I came to a small company and brought me some old birds, but not my company. I only came here for a few weeks. The first project that came to the company was a web project. There were a lot of repeated code in it, and the page code was the same. You are too watery. There are so many junk code, people are despised. People always need to be stabbed once or twice before moving forward. The same is true for falling in love. People will wake up after being hurt.

My ultimate goal is to complete the DropDownCheckList control. DropDwonList can only be single-choice, and this control can have multiple effects. I believe there are many examples on the Internet. Although the time for writing code has passed, but I still want to write more code and learn more. This article records the details that I learned step by step.

  • 2. Analysis

1. create a new class library named XYB. controls, XYB is the abbreviation of my real name. In this class library, add a class named TextEdit and create a new Web application named XYB. UI, in XYB. add a page in the UI named TextEditUI. aspx

  

2. Import the namespace

 System.ComponentModel;
System.Web.UI.HtmlControls;

3. Inheritance

Since Control development is a Web Control, the WebControl class must be inherited. The namespace of this class is System. Web. UI. WebControls, and WebControl inherits Control.

The TextBox Control inherits WebControl and has all the features of TextBox.

 System.ComponentModel; 

Generate a new one, and a TextEdit control will be displayed in the toolbar. If not, add the control following the steps below.
1. right-click a blank area under the toolbar --> Add tab, and name it XYB. the Controls component is named at will and then created in XYB. right-click a blank position in the "Controls" group of the "Controls" component and choose "select item"> browse to find XYB. controls. dll class library, add it in, so there is an additional TextEdit control in the toolbar

AutoEventWireup = CodeBehind = Inherits = %> <% @ Register Assembly = Namespace = TagPrefix = %> <! DOCTYPE html PUBLIC>

  • Prediction of the next set:

Custom TagPrefix tags. Stay tuned to me!

 

 

 

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.