It's easy to create your own ASP.net server control. When you create a simple custom control, all you have to do is define a class derived from System.Web.UI.Control and override its Render method. The Render method takes parameters of the System.Web.UI.HtmlTextWriter type. The HTML that the control sends to the client is passed to the HtmlTextWriter Write method as a string parameter.
For example:
Server control code (simple display String): Simple.cs:
Here is Simple.cs: Imports System Imports system.web Imports System.Web.UI Namespace Simplecontrolsamples public class Simplecsharp {
protected override void Render (HtmlTextWriter Output) { Response.Write ("<H2> Welcome to asp.net source Download professional station <H2>"); } } |
Referencing file simple.aspx:
Here is simple.aspx: <%@ Register tagprefix= "simplecontrolsamples" namespace= "Simplecontrolsamples" Simplecontrolsamplescsharp "%> <body> <form method= "POST" action= "simple.aspx" runat=server> <simplecontrolsamples:simplecsharp id= "MyControl" runat=server/> </form> </body> |