I have a master page file that inherits Main master page
<%@ Master Language="C#" MasterPageFile="~/HomePage.master" AutoEventWireup="true" CodeFile="Profile.master.cs" Inherits="Profile_Profile" %>
Structure of Profile.Master
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<li id="profilehome" runat="server">
<a href="#">
<i class="glyphicon glyphicon-home"></i>
Overview </a>
</li>
<asp:ContentPlaceHolder ID="masterprofile" runat="server">
</asp:ContentPlaceHolder>
/asp:Content>
I want to access the id ="profilehome"
from this page
<%@ Page Title="" Language="C#" MasterPageFile="~/Profile/Profile.master" AutoEventWireup="true" CodeFile="Setting.aspx.cs" Inherits="Profile_Setting" %>
<asp:Content ID="Content1" ContentPlaceHolderID="masterprofile" runat="Server"></asp:Content>
How do i do
ContentPlaceHolder cp = this.Page.Master.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
System.Web.UI.HtmlControls.HtmlGenericControl li1 = (System.Web.UI.HtmlControls.HtmlGenericControl)cp.FindControl("profilehome");
li1.Attributes.Add("class", "active");
Tried this i get Object reffrenece not found error. Since its unable to find