asp.net control design-time Support (1)

Source: Internet
Author: User
Tags empty

I. ControlDesigner class

ControlDesigner as the base class for the designer of a Web server control, you can extend this class. After you know this class, you will find that the control you see in the VS2005 design is the perfect presentation is also Microsoft to help you do. In this case, as a perfect control should also be equipped with design-time support, Sometimes the development can be achieved with a multiplier effect. Here we will not introduce the specific methods and properties of this class. We'll use it specifically.

Two. Get design-time associated control HTML

(1) Defining controls

Let's define the two simplest controls

public class Desgincontrol:control
{public
string Text
{
get
{
St        Ring S = (String) viewstate["Text"];
Return ((s = = null)?      STRING.EMPTY:S);
the set
{
viewstate["Text"] = value;
}
protected override void Render (HtmlTextWriter writer)
{
writer.    Write (Text);
}
public
class Desginwebcontrol:webcontrol
{public
string Text
{
get        
{
string s = (string) viewstate["Text"];
Return ((s = = null)?      STRING.EMPTY:S);
the set
{
viewstate["Text"] = value;
}
protected override void RenderContents (HtmlTextWriter writer)
{
writer.    Write (Text);
}
}

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.