So I have a menu on the master page that is in a table, and I want to change the background of the cell that the clicked link is in depending on the page the user is on.

I tried adding this function on the master page

public void HomePage()
        {
            HOMEPAGE.Style.Add(HtmlTextWriterStyle.BackgroundColor, "Red");       
        }

and then simply calling this function in the Page_Load of the content page but it didn't work.

Should I call this function in a different method like Init or PreInit, or am I using a wrong approach altogether?

write code behind the master page and find which menu was selected...depending upon selection change background of table..also write table id for find this table id in codebehind

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.