User control with asp control
<%@ Page %>
<%@ Register TagPrefix="user" TagName="SampleControl" Src="control.ascx" %>
<user:SampleControl runat="server" />
C# version (control.ascx)
<%@ Control Language="C#" %>
<script runat="server" language="C#">
void Page_Load(Object sender, EventArgs e)
{
lblSample.Text = "Sample Control Text";
}
</script>
<asp:label runat="server" id="lblSample" />
VB version (control.ascx)
<%@ Control Language="VB" %>
<script runat="server" language="VB">
Sub Page_Load(sender as object, e as EventArgs)
lblSample.Text = "Sample Control Text"
End Sub
</script>
<asp:label runat="server" id="lblSample" />
Related examples in the same category