Implement a simple custom control

Source: Internet
Author: User

 

Simple custom control
Using System;
Using System. Web. UI;
Using System. Web. UI. webcontrols;
Using System. componentmodel;

Namespace Simplecontrol
{
/**/ /// <Summary>
///Abstract description of webcustomcontrol1.
/// </Summary>
[Defaultproperty ( " Text " ),
Toolboxdata ( " <{0}: webcustomcontrol1 runat = Server> </{0}: webcustomcontrol1> " )]
Public   Class Webcustomcontrol1: system. Web. UI. webcontrols. webcontrol
{
Private   String Text;
// Attribute Bindable specifies whether a property is usually used for binding
// CATEGORY specifies the category of the attribute or event that will be displayed in the visualization designer
// Defalutvalue is used to specify the default value of an attribute.
[Bindable ( True ),
Category ( " Appearance " ),
Defaultvalue ( "" )]
Public   String Text
{
Get
{
ReturnText;
}

Set
{
Text=Value;
}
}

/**/ /// <Summary>
///This control is displayed to the specified output parameter.
/// </Summary>
/// <Param name = "output">HTML writer to write</Param>
Protected   Override   Void Render (htmltextwriter output)
{
Output. Write ("<Span>"+Text+"</Span>");
}
}
}

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.