Somesh Nag
How can we create custom controls in asp.net
By Somesh Nag in ASP.NET on Apr 05 2007
  • Apr, 2007 13

    In the Visual Studio There is option of creating Web Custom Control.

    Here i m giving one very basic example which is msdn.

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace CustomControls
    {
          public class FirstControl : Control
          {
                private String message = "Hello";

                public virtual String Message
                {
                      get
                      {
                            return message;
                      }
                      set
                      {
                            message = value;
                      }
                }

                protected override void Render( HtmlTextWriter writer)
                {
                writer.Write(" "
                            + this.Message + "
    " + "The time on the server is " + System.DateTime.Now.ToLongTimeString()
                            + "
    ");

                }

          }
    }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS