Exposing a server control from a master page as a public property (VB) : Master page « User Control and Master Page « ASP.Net






Exposing a server control from a master page as a public property (VB)

<%@ Page Language="VB" MasterPageFile="~/Default.master" %>
<%@ MasterType VirtualPath="~/Default.master" %>

<script runat="server" language="vb">    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Master.MasterPageLabel1.Font.Size = 25
    End Sub
</script>


File: Default.master

<%@ Master Language="VB" %>

<script runat="server" language="vb">    
    Public Property MasterPageLabel1() As Label
        Get
            Return Label1
        End Get
        Set(ByVal Value As Label)
            Label1 = Value
        End Set
    End Property
</script>
 <asp:Label ID="Label1" Runat="server" />

 








Related examples in the same category

1.Nested master page (C#)
2.Use master page (C#)
3.Master page with trace (C#)
4.Two Master Pages (C#)
5.Link content page with master page
6.Master page with Default Content
7.Master in page derivative
8.Two pieces of contentplaceholder
9.master for print
10.Control title in master page with content page code
11.Nested master page
12.Use image to fill the filler in master page
13.Code behind and master page
14.Specifying master page in Web.config causes every content page to inherit from the master page
15.Specifying the master page for a specific folder in the Web.config file: Use
16.A master page that creates a GUID on the first request (C#)
17.A master page that creates a GUID on the first request (VB)
18.A master page that exposes a custom property (C#)
19.A master page that exposes a custom property (VB)
20.Exposing a server control from a master page as a public property (C#)
21.Overriding some default content in the content page (C#)
22.Overriding some default content in the content page (VB)
23.Using Page_PreInit to assign the master page programmatically (C#)
24.Using Page_PreInit to assign the master page programmatically (VB)
25.A content page that can work with more than one master page
26.Update the page properties in master page
27.Nested master
28.Put site navigation in the master page
29.Master pages exposing an object model for content pages to programmatically modify elements on the master.