With the help of LoadControl of Page class,we can dynamically Load any User Controls:-
For Example:-
protected void Page_Load(object sender, EventArgs e)
{
Control myCtrl = null;
myCtrl = Page.LoadControl("~/UserControls/UcTeamControl.ascx");
Page.Controls.Add(myCtrl);
}
UcTeamControl.ascx will look like this:-
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="UcTeamControl.ascx.vb" Inherits="UcTeamControl" %>
<table cellpadding="1" cellspacing="1">
<tr>
<td align="left" valign="middle">
<asp:Button ID="btn_new" runat="server" Text="New" />
<asp:Button ID="btn_Save" runat="server" Text="Save" />
<asp:Button ID="btn_reset" runat="server" Text="Reset" />
<asp:Button ID="btn_delete" runat="server" Text="Delete" />
</td>
</tr>
</table>