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);
}
}