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

I have a webpart .I have a grid view with templatefield . I want open Custom Listfrom in popup window. I use this code in LinkButtonClick

  PostBackUrl="javascript:SP.UI.ModalDialog.showModalDialog({ url: '../Lists/GBE/NewForm.aspx', title: 'User Survey' }); return false;"

but don't run!

I use the following code in Hyperlink

  NavigateUrl="javascript:OpenPopUpPageWithTitle('addressurl',RefreshonDialogClose,400,600,'')"

this Oepn popup , but when use this code for LinkButton , Don't run!

share|improve this question

1 Answer 1

You need to use SP.UI.ModalDialog.showModalDialog... for using the SharePoint Modal dialog.. Check the sample code below...

function OpenModalDialog() {
var options = SP.UI.$create_DialogOptions();
options.width = 500;
options.height = 250;
options.url = "/_layouts/MyPage.aspx";
options.dialogReturnValueCallback = Function.createDelegate(
                    null, portal_modalDialogClosedCallback);
SP.UI.ModalDialog.showModalDialog(options);}
share|improve this answer
    
Please read my update.i use this code but don't run . –  ar.gorgin Jan 2 '12 at 6:08
    
did u include sp.js??? –  Strider Jan 2 '12 at 6:41
    
yes, I add <script> –  ar.gorgin Jan 2 '12 at 7:11
    
Check by adding this in your page <SharePoint:ScriptLink runat="server" Name="sp.js" OnDemand="true" Localizable="false" /> –  Strider Jan 2 '12 at 7:25
    
Yes ,I add this code. –  ar.gorgin Jan 2 '12 at 7:54

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.