Graphical display, inheriting webcontrol class

Source: Internet
Author: User
System. Web. UI. webcontrols. webcontrol class
Main attributes:
Attribute Type Description
Controls Controlscollection Child widget
Controlstyle Style Style
Controlstylecreated Bool Returns a value indicating whether a style object is created for controlstyle.
Enabled Bool
Tagkey Htmltextwritertag Obtain the system. Web. UI. htmltextwritertag value corresponding to the control.

Main Methods:
Protected virtual void addatrributetorender (htmltextwrter writer) Design Style
Protected override void render (htmltextwriter writer) overrides render
Protected virtual void rendercontrols (htmltextwriter writer) displays the control content.
Public virtrual void renderbegintag (htmltextwrtier witer)
Public virtrual void renderendtag (htmltextwrtier witer)
Public void applystyle (Style S) copies the User-Defined style to the control. If there is overlap, rewrite the control style
Publie void mergestyle (Style S) copies the specified style to the control. If there is overlap, the existing style elements of the control are not rewritten.
Public irtualstylecreatecontrolstyle () webcontrol class internal Style

Using System;
Using System. Collections. Generic;
Using System. text;
Using System. componentmodel;
Using System. Web. UI;

Namespace Usercontrols
{
[
Defaultproperty ( " Text " ),
Toolboxdata ( " <{0}: webcustomercontrol runat = Server> </(0): webcustomercontrol> " )
]
Public   Class Userrendertest2: system. Web. UI. webcontrols. webcontrol
{
Private   String Text = "" ;
Private   String Href = "" ;

Public Userrendertest2 (): Base (System. Web. UI. htmltextwritertag. Div)
{
}

[
Description ( " To show text " ),
Bindable ( True ),
Category ( " Appearance " ),
Defaultvalue ( " " )
]
Public   String Text
{
Get {ReturnText ;}
Set {Text=Value ;}
}

[
Description ( " To show href " ),
Bindable ( True ),
Category ( " Appearance " ),
Defaultvalue ( " " )
]
Public   String Href
{
Get   {ReturnHref ;}
Set   {Href=Value ;}
}


Protected   Override   Void Addattributestorender (system. Web. UI. htmltextwriter writer)
{
Writer. addstyleattribute (system. Web. UI. htmltextwriterstyle. borderstyle,"#999 1px solid");
Base. Addattributestorender (writer );
}

Public   Override   Void Rendercontrol (system. Web. UI. htmltextwriter writer)
{
Writer. addattribute ( " Onmouseover " , " This.style.css text = 'color: red' " );
Writer. addattribute (system. Web. UI. htmltextwriterattribute. href, href );
Writer. renderbegintag (system. Web. UI. htmltextwritertag. );
Writer. Write (text );
Writer. renderendtag ();
Base . Rendercontrol (writer );
}

}
}

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.