Introduction
I have already discussed about Master Page Properties Exposing in my previous, in that article we have already discussed how to modify a property
of a control located in a Master Page from a content page by exposing a property
from the Master Page. We have an alternative here by using Find Control with
Master Page. If we need to modify a control in a Master Page, we can use the
FindControl() method in a content page. For example, the Master Page given below
includes a Literal control named MasterBodyTitle. This Master Page does not
include any custom properties by default.
Master Page Code
<%@
Master Language="VB"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Public
Property MasterBodyTitle()
As String
Get
Return
ltlMasterBodyTitle.Text
End Get
Set(ByVal
Value As String)
ltlMasterBodyTitle.Text = Value
End Set
End
Property
</script>
<html
xmlns="http://www.w3.org/1999/xhtml">
<head
id="Head1"
runat="server">
<style
type="text/css">
html
{
background-color:silver;
}
.content
{
margin:auto;
width:700px;
background-color:white;
padding:10px;
}
h1
{
border:3px
dotted blue;
}
</style>
<title>Using
Find Control with Master Page</title>
</head>
<body>
<form
id="form1"
runat="server">

Join the conversation! Your thoughts help the community grow.