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


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


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);
  • 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

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.