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.
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 firstname.lastname@example.org