Using the HtmlTextWriter to render an HTML tag (C#) : Extends WebControl « Custom Controls « ASP.NET Tutorial






using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebControlLibrary1
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
    public class WebCustomControl1 : WebControl
    {
        private string text;

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        public string Text
        {
            get
            {
                return text;
            }
            set
            {
                text = value;
            }
        }

        protected override void Render(HtmlTextWriter output)
        {
            output.RenderBeginTag(HtmlTextWriterTag.Input);
            output.RenderEndTag();
        }
    }
}








14.23.Extends WebControl
14.23.1.The Visual Studio Web Control Library class template (C#)
14.23.2.The Visual Studio Web Control Library class template (VB)
14.23.3.Adding a Web Control Library to a Web page
14.23.4.Using the HtmlTextWriter to render an HTML tag (C#)
14.23.5.Using the HtmlTextWriter to render an HTML tag (VB)
14.23.6.Using the HtmlTextWriter to render multiple HTML tags (C#)
14.23.7.Using the HtmlTextWriter to render multiple HTML tags (VB)
14.23.8.Rendering HTML tag attributes (C#)
14.23.9.Rendering HTML tag attributes (VB)