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 Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (1)

Collapse
 
feded profile image
Federico Norberto Dutto

thanks !!!!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs