Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How can I bring a value to SharePoint Dialog to bind data. I call the dialog like this

<input type="button" value="<%#((DataRowView)Container.DataItem)["Id"] %>"   onclick="javascript:Open()" />

The script

<script type="text/javascript">
    //User Defined Function to Open Dialog Framework
    function Open() {

        var strPageURL = '<%= ResolveClientUrl("~/View.aspx") %>';
        OpenCustomDialogWithRefresh(strPageURL, 650, 400, "Add Document Type");
        return true;
    }
</script>

JS

function OpenCustomDialogWithRefresh(dialogUrl, dialogWidth, dialogHeight, dialogTitle, dialogAllowMaximize, dialogShowClose) {

var options = {
    url: dialogUrl,
    allowMaximize: dialogAllowMaximize,
    showClose: dialogShowClose,
    width: dialogWidth,
    height: dialogHeight,
    title: dialogTitle,
    dialogReturnValueCallback: Function.createDelegate(null, CloseCallback4)
};
SP.UI.ModalDialog.showModalDialog(options);}

I don't know how to bring the Id value to the View.aspx.

share|improve this question

2 Answers 2

You can pass it as a parameter to Open() function and then to OpenCustomDialogWithRefresh() function. You can pass it on as a query string parameter like:

strPageURL = strPageURL + '?id=" + idParam

You can access the query string parameter in View.aspx.

You can also pass it as args property of your options. Check this article: http://www.chaholl.com/archive/2010/11/17/using-the-dialog-framework-in-sharepoint-2010.aspx

share|improve this answer

Refer to this blog

Provide args to options which you pass to ShowModalDialog function. Then in modal dialog just retrieve the args through window.frameElement.dialogArgs You can pass simple values and whole objects.

share|improve this answer

Your Answer

 
discard

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.