This project is read-only.

Delete confirmation

Sep 9, 2011 at 8:17 PM

What is the way to add Delete Confirmation box on deleting a treeview node?

Sep 9, 2011 at 9:23 PM

You have to define a custom delete button tha calls your js function that ask for the confirmation and then calls the normals js function to delete a node.

The simplest way  to redefine a delete button is by using a manipulation button:

private static string customRemoveButtonScript = "MvcControlsToolkit_TreeView_CustomDelete(\"{0}\");";

public static MvcHtmlString MyCustomTreeViewDeleteButton<VM>(
            this HtmlHelper<VM> htmlHelper,
            string textOrUrl,
             ManipulationButtonStyle manipulationButtonStyle = ManipulationButtonStyle.Button,
            IDictionary<string, object> htmlAttributes = null,
            string name = null)
            string id = htmlHelper.PrefixedId("Container");
            return htmlHelper.ManipulationButton(ManipulationButtonType.Custom, textOrUrl,
                                  string.Format(customRemoveButtonScript, id), name == null ? id + "_RemoveButton" : name, manipulationButtonStyle, htmlAttributes);

Then define your js function MvcControlsToolkit_TreeView_CustomDelete:

function  MvcControlsToolkit_TreeView_CustomDelete(nodeRootId){


//call standard delete to perform deletion




Sep 10, 2011 at 2:51 AM


Thank you!