(Original) Simple label Control for self-implemented server controls

Source: Internet
Author: User

Title: Label Control for self-implemented server controls

Statement: This post is only a test demo. Therefore, it will not be written too standard or considered for security. for convenience. therefore, we hope to improve it when using it in projects.

Environment

Development Tool: vs.net 2003

Database: SQL Server 2000

Author: endless Wandao

Date: 2006-02-20

Reader requirements: have certain programming experience.

Principle: encapsulate HTML controls.


Using system;
Using system. Web. UI;
Using system. Web. UI. design;
Using system. Web. UI. webcontrols;
Using system. componentmodel;
Using system. componentmodel. design;

Namespace skyendless. mycontrols
{
/** // <Summary>
/// Summary of webcustomcontrol1.
/// </Summary>
[Defaultproperty ("text "),
Toolboxdata ("<{0}: Label runat = Server> </{0}: Label>")]
Public class label: system. Web. UI. webcontrols. webcontrol
{
Private string text;

[Bindable (true ),
Category ("appearance "),
Defaultvalue ("")]
Public String text
{
Get
{
Return text;
}

Set
{
TEXT = value;
}
}

/** // <Summary>
/// Present the control to the specified output parameter.
/// </Summary>
/// <Param name = "output"> HTML writer to be written </param>
Protected override void render (htmltextwriter output)
{
String outputhtml = "<Div name =" + this. uniqueid + ">" + this. Text + "</div> ";
Output. Write (outputhtml );
}

}
}

Note: I will continue to implement several common server controls in the future.
This is just a simple custom control.
You cannot drag a widget to control its size.
Now, you can see that you can drag the label control of the size with the mouse when designing the server control series.

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.