Sep 29, 2009

How to access the Content Place Holder and Control placed inside some place holder in master page programmatically

There is requirement to access the control placed inside the PlaceHolderMain in the master page.

We can place this code inside the CreateChild Control method:

Control customControl = this.Page.Master.FindControl("ControlName");

Similarly to access the Content Place inside CreateChildControl method of webpart use this code snippet :

ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolderName");

So now your job is done J

If you have any queries then please let me know

Enjoy!!!

No comments:

Post a Comment