DEV Community

0 seconds of 5 minutes, 49 secondsVolume 90%
Press shift question mark to access a list of keyboard shortcuts
00:00
00:00
05:49
 
vblover programmer
vblover programmer

Posted on

1

Asp .Net: Create a Simple 'Web User Control'

Web User Control:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="NewUserControl.ascx.vb" Inherits="MyProjectsWebApplication.NewUserControl" %>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

Enter fullscreen mode Exit fullscreen mode

Create Property for 'Web User Control':

Public Class NewUserControl
    Inherits System.Web.UI.UserControl

    Public Property Caption() As String
        Get
            Return Me.Label1.Text
        End Get
        Set(ByVal value As String)
            Me.Label1.Text = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class
Enter fullscreen mode Exit fullscreen mode

Rehister 'Web User Control' at Web-Form:

<%@ Register TagPrefix="UC" TagName="NewUserControl" Src="~/NewUserControl.ascx"  %>

Enter fullscreen mode Exit fullscreen mode

Using 'Web User Cotrol' in 'Web-Form':

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
  <UC:NewUserControl runat="server" Caption="My First Web User Control" />
</asp:Content>

Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (1)

Collapse
 
feded profile image
Federico Norberto Dutto

thanks !!!!

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay