When used it:
The Feature Receivers can be used If you want to perform any action programmatically using C# code like when feature is installed, uninstalled, activated or deactivated.
The Feature Receivers can be used If you want to perform any action programmatically using C# code like when feature is installed, uninstalled, activated or deactivated.
e.g. I will share one of my best experience about on
feature receivers when it’s most required.
Task: I want to develop one custom master page and set that
master page as default master page to the site.
Sol: Below are my development approaches on it.
- First created a custom master page using existing master page through SharePoint designer.
- Deployed that custom master page to the master page gallery using “Feature”.
- Finally, write c# code to set our masterpage as default master to the site using “feature receiver”[means I wrote c# code to set our custom master page as default master page inside of “FeatureActivated” event]. Here the feature receiver will run whenever the feature is activated.