In a master page I got a panel which I want to add controls to it from the master page's code behind as follow:
var cphRegionName = this.Page.FindControl("pnlLeft") as Panel;
cphRegionName.Controls.Add(uc);
but I get this error:
Object reference not set to an instance of an object at cphRegionName.Controls.Add(uc);
I have tried all possible other ways, but get the same error.
The reason I user FindControl to access the PANEL is the panel's name is dynamic ("pnlLeft"), reading from Database.