SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question

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


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.