User Control source file :
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>
<asp:Button id="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click"/>
And CS file:
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
Response.Write("Hello UserControl");
}
And Page Source file:
<%@ Register Src="~/WebUserControl.ascx" TagName="user" TagPrefix="btn" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<btn:user id="btn1" runat="server"/>
</asp:Content>
working fine