简体   繁体   中英

Sharepoint How to show popup when click on gridview?

I using Gridview control on sharepoint. I'm Bind data to column Name of Gridview. And now, I want to click direct on row of column Name, program will display detail popup window of this row. Thanks !

I dont know if I understand you right but you could try opening a ModalDialog directing to a custom .aspx Page to Display your Information

http://sqldev-samir.blogspot.de/2012/08/open-modal-dialog-in-serverside-code-in.html

Here is client-side code to open a dialog box that will point to a page which contains the detail (editform.aspx, in this example). This code also causes a postback so the grid gets updated with the changes the user makes on EditForm.aspx.

function CloseCallback(result, target)
{
    eval(<%=Page.ClientScript.GetPostBackEventReference(new PostBackOptions(Button1))%>);    
}
function OpenDialog(url)
{ 
    var options = {
        url: url,
        title: '',
        allowMaximize: true,
        showClose: true,
        width: 700,
        height: 800,
        dialogReturnValueCallback: CloseCallback
    };

    var dlg = SP.UI.ModalDialog.showModalDialog(options);

}

And here is the server-side code to add the hyperlink column to the grid (this happens to be a RadGrid instead of an SPGridView server control). This column will display a hyperlink that points to the above JavaScript function and when clicked opens EditForm.aspx with the data from the selected row item.

GridColumn fldEditLink = new GridHyperLinkColumn() { UniqueName = "Edit", Text = "Edit/View",DataNavigateUrlFields = new string[] { "ID" }, DataNavigateUrlFormatString =String.Format("javascript:OpenDialog('{0}/Lists/Events/EditForm.aspx?ID={{0}}');", web.Url) };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM