I am using nested master pages where i want to use Label
control from nested master page and update its text. but it is not accessing. When i removed outer master page then it is working fine. Following is the markup and code.
OUTER MASTER
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Roster.Site" %>
NESTED MASTER
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="RoasterMaster.master.cs" Inherits="Roster.RoasterMaster" MasterPageFile="~/Site.Master" %>
<%@ MasterType VirtualPath ="~/Site.Master" %>
CONTENT PAGE
<%@ Page Language="C#" AutoEventWireup="true" Inherits="RequestsView" CodeBehind="ViewRequestsByPM.aspx.cs" MasterPageFile ="~/Roaster/RoasterMaster.Master" Title ="Roaster- View Requests by PM" %>
<%@ MasterType VirtualPath ="~/Roaster/RoasterMaster.Master" %>
CONTENT PAGE CODE
protected void Page_Load(object sender, EventArgs e)
{
Label lblTitle = new Label();
lblTitle =(Label)Master.FindControl("lblTitle");
lblTitle.Text = "View Roaster Request";
}
What is going wrong with the implementation. Please help. Thanks