Is there any alternate for SP.UI.ModalDialog in SharePoint 2007 ? how can we use Modal Dialog in SharePoint 2007 ?


commonShowModalDialog is a little bit similar to SP.UI.ModalDialog but opens window in popup window. SPFieldUser and BDC field use this function to open their search pages. Here already answered how you can use this function

  • This is SharePoint 2007 functionality – Michael Jan 31 '14 at 9:07
  • sorry ill take that back it is ;), my bad – Ali Jafer Jan 31 '14 at 9:11

somthing on the lines of:

function Confirm() {
    //create an input form
    var confirm_value = document.createElement("INPUT");
    //make varible hidden
    confirm_value.type = "hidden";
    confirm_value.name = "confirm_value";
    //text you want to show
    if (confirm("Are you sure you want to Delete this?")) {
        confirm_value.value = "Yes";
    } else {
        confirm_value.value = "No";
    //add to page the value to use in code behind

that is within the aspx or js file.

aspx button:

create a button in aspx and create an event call onClientClick event and call the method above.


to call the above within .cs:

create the button in aspx or though code behind, create a click event (not client click event).

    private void DeletButton_Click(object sender, EventArgs e)
        Button delID = sender as Button;

        string confirmValue = Request.Form["confirm_value"];
        if (confirmValue == "Yes")
            Request.Form["confirm_value"].Remove(0, Request.Form["confirm_value"].Length);

            //if yes clicked do what you want
        //do nothing if no or make else to do somthin when user clicks no

now to register the client side (js) on the button call the method:

.OnClientClick = "Confirm();";

so through code:

                Button DeletButton = new Button();
                DeletButton.ID = " Delete";
                DeletButton.Text = "Delete";
                DeletButton.OnClientClick = "Confirm();";
                DeletButton.Click += new EventHandler(DeletButton_Click);

or in aspx:

    <asp:Button ID="DeletButton" runat="server" Text="Delete" onclick="DeletButton_Click" OnClientClick = "Confirm();"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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