Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a SP2010 site and I am trying to open a modal dialog as a result of a button click.
I have searched and tried everything that I have seen and have had no luck. Here is the aspx page script and the code behind which fires but does not render the page.

C#
function OpenAssignDialog(sID) {
        var dialogOptions = {
            url: "../jo_dreamsheet/add.aspx?sID=" + sID,
            autoSize: true,
            allowMaximize: false,
            dialogReturnValueCallback: onCloseCallback
        };
        var did = SP.UI.ModalDialog.showModalDialog(dialogOptions)
    }

    function onCloseCallback(dialogResult, returnValue) {
        window.top.location = "../jo_dreamsheet/dreamsheet.aspx";
    }


This is the code behind that everyone seems to say should work.

C#
protected void btn_click(object sender, EventArgs e)
{
string bin = bin_label.Text;
           ClientScript.RegisterStartupScript(this.GetType(), "", "SP.UI.ModalDialog.showModalDialog({ url: '../jo_dreamsheet/add.aspx?sID=" + bin + "'}); return false;", true);



In desperate need of help. Please be specific as possible, seems most answers I can find seem to assume information that is not available.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900