how do i edit a masterpage div from child page?

korben picture korben · Oct 15, 2010 · Viewed 9k times · Source

what's the DIV equivalent to this command?

((Panel)this.Page.Master.FindControl("Panel1")).Style.Add("display", "none");

This works great with a panel but I can't find the variation for doing the same thing with a DIV who's ID I know. anyone know?

thanks in advance for the help!

Answer

AsifQadri picture AsifQadri · Oct 16, 2010

Div belongs to HtmlGenericControl class of System.Web.UI.HtmlControls namespace.

((HtmlGenericControl)this.Page.Master.FindControl("divID")).Style.Add("display", "none");

and your your div control in master page sholud be runat="server"

Thanks

Asif