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;


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)

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


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


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.

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.