Last post Jun 16, 2008 09:39 AM by mharris1984
Jun 16, 2008 08:14 AM|nithi.anitha|LINK
I'm new to asp.net2.0.please tell me how to create a custom control and how to use the that in more than one web applications.
thanks in advance..
Jun 16, 2008 09:12 AM|mihirpathak|LINK
If you want to learn about ASp.NET Custom Control try to read this book by Nikhil Kothari is one of the best in Microsoft. "Developing Microsoft ASP.NET Server Controls and Components" (Pro-Developer) (Paperback)by
Nikhil/Datye, V. Kothari (Author)
"ASP.NET inherits its programming model from
MSDN is the best site to look . One of the link is
Developing Custom ASP.NET Server Controls
Jun 16, 2008 09:23 AM|gbogea|LINK
Here are some useful links:
http://asp.net/learn/videos/video-194.aspx (This is a video tutorial)
Jun 16, 2008 09:39 AM|mharris1984|LINK
Here is a very brief overview..
In C# you'll need to create a class library project that compiles into a dll. Here is an example of a custom control class.
public class MyControl : Control
protected override void CreateChildControls()
Label myLabel = new Label();
myLabel.Text = "im a custom control";
Note how this class inherits from the System.Web.UI.Control class. The overidden CreateChildControls method allows you to add other Controls and html elements to the page.
This will need to be compiled into a .dll and saved into the bin directory of your web applications. This control can then be added to your .aspx page as follows.
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register TagPrefix="XXX" Assembly="mycontrol" Namespace="CustomControls" %>
<form id="form1" runat="server">
<XXX:MyControl runat="server"> </XXX:MyControl>