To create a Feature receiver
In Microsoft Visual Studio, start an Empty SharePoint Project. When you are prompted, choose to make it a sandboxed solution.
In Solution Explorer, right-click the Features folder, and then select Add Feature.
Right-click the Feature, and select Add Event Receiver.
5. Uncomment and override the event handlers in the file as needed using your event handling logic. As a general rule, if you override the FeatureActivated handler, you should also override the FeatureDeactivating handler to reverse what your code did in the FeatureActivated handler. Similarly, if you override the FeatureInstalled handler, you should also override the FeatureUninstalling handler to reverse what your code did in the FeatureInstalled handler.
6. Now to customize the top link bar, first you need to add the following reference:
Then place the following code inside appropriate event handlers:
As told earlier, if you override the FeatureActivated handler, you should also override the FeatureDeactivating handler to reverse what your code did in the FeatureActivated handler. So, place the following code inside FeatureDeactivating event handler:
Now build the solution and then deploy it. Go to the particular SharePoint site where you want to apply this custom global navigation i.e., to update the top link bar. Now go to the Site Action > Site Settings page and from there select the ‘Manage Site Features’ option. On the Site Features page you will find our Custom Feature. Just activate it and you will see custom links has been added to the to link bar or global navigation bar. Now again come to the Site Action > Site Settings page and from there select the ‘Manage Site Features’ option again. Now deactivate our custom feature and you will see, the custom links that we have added by activating the feature just a few minutes ago, has disappeared.
Feature Receiver is a very powerful product and if you use it properly it will help not only you but the business users also to achieve some custom functionality by just activating – deactivating some feature!