steps for creating web user control:
1.Add User Control in project Select "Web User Control" from New Item Window and name it .
2.Add following code to file .ascx
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="ucImageViewer.ascx.cs" Inherits="ucImageViewer" %>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<asp:Image ID="Image1" runat="server" />// using image you can use label or text as per requirement
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="Button1" runat="server" Text="Original View"
OnClick="Button1_Click" />
</td>
</tr>
</table>
3. add event handler and perform required operation in ascx.cs file like:
protected void Button1_Click(object sender, EventArgs e)
{
}
4.Ad peroperites if any
5.Now to display Web User Control on Web Form in asp.net:
<%@ Register Src="ucControlName.ascx" TagName="somename" TagPrefix="uc" %>
here
Src - It specifies source of web user control.
TagPrefix - It Specifies Prefix for user control, i.e. Namespace to which it belong.
TagName - It Specifies Alias to the user control. i.e. Id to Control.