http://www.sharepointkings.com/2009/09/add-web-part-inside-master-page-in-moss.html
Later on i moved the web part reference out of the content place holder and made the visible attribute of the content place holder to false.
But now the requirement is to dynamically turn it ON and OFF (i.e through code)
Lets follow the steps given below to achieve this:
1. Go to the page_load method of the web part.
2. Write the following lines of code.
if (!Page.IsPostBack)
{
ContentPlaceHolder contPlcHolder = (ContentPlaceHolder)Page.Master.FindControl("PlaceHolderGlobalNavigation");
contPlcHolder.Visible = false;
//Rest of the code
}
If there is any nested content place holder then append that number of FindControl("ControlName") to the above code where we are finding the control.
That's it. Save the code and deploy the latest web part code.
If you are facing any issue then email us at sharepointkings@gmail.com
No comments:
Post a Comment