Today new scenario, solution J
This feature is responsible for provisioning “GettingStarted.aspx” page and adding link to site action menu
We have written one user control “RemoveGettingStartedWPFromPage.ascx”. From code behind we have hide the “GettingStartedWebPart” web part as (just sample code :))
web.AllowUnsafeUpdates = true;
Added one feature and using feature added our user control to “AdditionalPageHead” control as
Now this code will be executed when page will be loaded. But we want to execute this code only once and not every time workspace is get executed.
So we are deactivating the feature from the user control after hiding the web part as
// trying to deactivate the feature that this control is linked to so that this code will not run again.
And we are done. This is the way to execute the code only once :)
But this solution is purely for farm solution, I’ll write new post soon for SharePoint online.
Also important point here is an idea to execute the particular code only once on the page.
Enjoy reading :)
Feel free to comment / feedback if any or if you have any query :)