I have a button that I've added to our masterpage in Sharepoint Designer. What is the best way to write c# code to that button? I'd like to do this in visual studio if possible. Thanks,
|
|
There are two ways you can consider: 1) If you want to directly access other controls on the master page in the *button_click* event handler, you should go for creating code behind for master page. You have to create a class and compile it to a dll, deploy to GAC.Then you can apply it to master page using below directive:
2) If the functionality in the button is not dependent on other controls, You can just create a custom control with button and place it on master page after registering the tagprefix. |
|||
|
|
|
The main problem is control deployement. Basically, user control contains to parts - ascx fire and assembly. If you would like to use this control, first at all, you should place ascx file to the _ControlTemplates folder and assembly to the GAC, then reset iis. Thus I think that the best way is to use package for control deployment. In this case the easiest approach is to use Visual Studio that builds this package automatically. |
|||
|
|
|
You will need to make a few key decisions before selecting the strategy for button implementation and master page customization. Are you a farm admin? Do you control all site that you are targeting the master page for? |
|||
|
|