User control with asp control

Gopesh9
Posted by Gopesh9 under ASP.NET category on | Points: 40 | Views : 953
<%@ 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" />

Comments or Responses

Login to post response