Definitions and differences between user controls and custom controls

Source: Internet
Author: User
Control | difference (one). Overview of user controls and custom controls
User Control (UserControl): The extension is *.ascx, similar to the *.aspx structure, refers to the page
A loaded feature block, except that the user control cannot be run as a page alone, and must be embedded in a *.aspx page or other
User control.
Custom controls, similar to HTMLControl or WebControl, can be compiled to add references to toolbars
, use the mouse directly to drag.

(b). Use
In a large system, there are sometimes only a few *.aspx pages, and the rest are made into *.ascx pages,
This enhances the coupling between pages, and a user control *.ascx as a separate feature block.
A custom control means that you can put it directly into the Toolbox after compilation, just like Textbox,datagrid.
You can use the mouse to drag onto the page in the designer.
Custom server controls fall into two categories:
1. One is compiled with *.aspx code and *.cs code to build the DLL, and then add references to the Toolbox for use.
Generally used in WebForm.
2. The other is to use only the *.cs implementation, and then compile the build DLL and add it to the toolbox.
Generally used in WinForm.
Custom Control Generation steps:
Like what:
1. Drag a button from the designer to the page,
Set a fixed value on the button size, color, or text to save the file name: A.cs
2. Csc/r:system.dll/t:library/out:. \.. \a.dll A.cs
3. Right-click in the Toolbox space, pop-up right-click menu, select "Add Remove", will just build the DLL
Add it to the toolbox so that you can drag like a button to use the

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.