Running server-side code from the Ribbon

…no you cannot do that as far as I know, you still have to rely on javascript code (like, but not only, the Client Object Model);  that said, there is a workaround if you don’t want to invoke an aspx page or to display a Dialog ; I ran across the following article from MSDN and I noticed that in this example, Microsoft uses the good old javascript:__doPostBack(‘….’,’….’) instruction as illustrated below :



In this specific case, the value of the first parameter (‘DownloadZipDelegateEvent’) will be stored in an hidden field named __EVENTARGET, well known by most Asp.Net developers.

If we want to handle this postback, we can just add a web control in the master page as illustrated here :



Of course the good practice is to create a  delegate control that will be associated to AdditionalPageHead delegate which is the only control which has ‘AllowMultipleControls’ attribute set to true.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s