Good afternoon everyone
I create a page in ASP.NET and use master pages in this process.
I have the name of the content owner "cphBody" on my wizard page, which will contain the body of each page for which this wizard page is the main page.
On an ASP.NET webpage, I have a Content tag (link "cphBody") that also contains some controls (buttons, Infragistics controls, etc.) and I want to access these controls in a CodeBehind file . However, I cannot do this directly (this.myControl ...), since they are nested in the Content tag.
I found a workaround using the FindControl method.
ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder) Master.FindControl("cphBody"); ControlType myControl = (ControlType) contentPlaceHolder.FindControl("ControlName");
This works great. However, I suspect this is not a very good design. Do you guys know a more elegant way to do this?
Thanks!
Guillaume Gervais.
Guillaume gervais
source share