I have created a Sharepoint WebPart, and I have given it a custom ToolPart that includes a Grid (a Telerik RadGrid, to be exact, though that is rather irrelevant). I have populated the grid, and created a GridButtonColumn object to add to the grid:

protected override void CreateChildControls()
            GridButtonColumn c = new GridButtonColumn();
            c.ConfirmText = "Really Delete?";
            c.ConfirmDialogType = GridConfirmDialogType.RadWindow;
            c.ConfirmTitle = "Delete";
            c.ButtonType = GridButtonColumnType.LinkButton;
            c.Text = "Delete";
            c.UniqueName = "DeleteColumn";
    // ...

    grid.DeleteCommand += new GridCommandEventHandler(Grid_DeleteCommand);

The grid renders correctly - populated with data and with the delete button present.

Now, when I click any of the delete button, the Grid_DeleteCommand() event does not get triggered. However, when I add a random button outside of the grid, it's click event gets triggered:

Button b = new Button();
    b.Text = "Hello World";
    b.Click += new EventHandler(Button_Click);

I'm not able to debug on this installation of Sharepoint (or maybe I can, but attaching to the process hasn't allowed me to do so yet), so the method of both of those events is simply a redirection to Google. That is how I check to see if the events fire:

    string AbsoluteUri ="http://www.google.com";

The only difference I can see between the two is that, with the 'Delete' button, it is nested inside of a Grid control, whereas with the 'Hello World' button, there is no nesting.

How would I be able to have the Grid_DeleteCommand fire when I click the button in the grid?

  • You say that the fact that you are using a Telerik grid control is irrelevant, but it seems that the problem arises with controls rendered inside the Telerik control. Are you sure this is a general SharePoint question? If it is Telerik related then you should ask it on the Telerik support forum as it would be off-topic here. Thanks.
    – SPDoctor
    Commented Feb 8, 2012 at 17:57
  • I'm open to the possibility. However, I have the same issue as described above when using asp.net controls. Further, when I do the above in a standard asp.net webforms app, it works.
    – splatto
    Commented Feb 8, 2012 at 18:09
  • Okay, we'll take your word for it.
    – SPDoctor
    Commented Feb 8, 2012 at 21:51

1 Answer 1


The answer is - I was missing a single line of code to set a property of the column:

c.CommandName = "Delete";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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