O'Reilly logo

Special Edition Using® Microsoft® ASP.NET by Richard Leinecker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting Started: Creating SimpleControl

We’re going to get started by creating a simple control that outputs a text string to the HTML stream. It has a single property with which the output string can be set, or the control can be used with the default string.

Take a look at the control’s source code in Listing 13.1, and then I’ll talk about it. This code would be found in your .cs source code file if you were adding a control to your project.

Listing 13.1. The Source Code for SimpleControl
 [DefaultProperty(“Text”), ShowInToolbox(true), ToolboxData(“<{0}:SimpleControl runat=server></{0}:SimpleControl>”)] public class SimpleControl : System.Web.UI.WebControls.WebControl { private string m_strText; [Bindable(true), Category(“Appearance”), DefaultValue(“<h1>.NET ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required