SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
MenuTemplate menuTemplate = new MenuTemplate();

menuItem = new MenuItemTemplate("Delete document", "/_layouts/images/delete.gif");
            menuItem.ClientOnClickScript = ""; // What should I put there

On line, menuItem.ClientOnClickScript, what should I put there, so that I can delete document?

share|improve this question

You need to call a Javascript (or SharePoint JS-ECMA) function passing "this" as a parameter (plus any other parameters you see fit).

"ConfirmDeleteThenPostBack(this, '%SomeParameter%')";

The function must also exist already loaded, e.g. via a ScriptLink control in the master page, or any other technique available (e.g. script tags).

One example doing exactly that could be seen here and a full example to build your custom menus on SPGridView is

share|improve this answer
Ok. I have seen the links. But I need a javascript function for this. Can u write a function for me? – SPBeginer Apr 4 '13 at 11:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.