none
How to open a pop up window /modal dialog in a MOSS 2007 web part ?

    Question

  • Hi,

    I have a req. where in i need to check whether cookies are present in the  page_load of sharepoint usercontrol web part - if  there is no cookiepresent, then i need to pop up a SignIn page -an application page - user will sign in - button click-i wil set the cookies and redirect to the web part page.i am stuck with how to get this  appln page as a pop up window.

    i used the below code:


              string javaScript =
    "<script type='text/javascript'>\n" +  "<!--\n" +  "window.onload = function ()\n" +  "{\n" +
    " window.open('/_layouts/myBISWebParts/WPSignIn.aspx', 'Sign In','width=300px,height=200px');\n" +
    "}\n" +  "// -->\n" +  "</script>\n";

    Page.ClientScript.RegisterStartupScript(typeof(Page), "notification", javaScript, true);

    but it didnt  work. it simply went thru the code, without the pop up and showed me the webpart!!

    i am not using ajaxcontroltoolkit so cant use popupextender control. is there any way i can open a modal dialog sign in window in MOSS 2007?

     

     

    any help is appreciated


    trutrutr
    • Moved by Kris Wagner - MVPMVP Monday, August 08, 2011 1:26 PM Moved to Dev thread (From:SharePoint - General Question and Answers and Discussion (pre-SharePoint 2010))
    • Edited by Mike Walsh FIN Monday, August 08, 2011 1:27 PM SP 2010 reference removed. Off-Topic. HOW in title changed to How + ?
    Monday, August 08, 2011 12:41 PM

Answers

  • For Ajaxify the production environment, I think it is better develop your own Feature to add entry in Web.Config. you can test it at first at your dev environment and then deploy it on production. before that be sure which version of AJAX is install on production and then use save version in your dev environment. It is better and safe idea.

     

    Jayant


    Jayant Sharma
    Wednesday, August 10, 2011 6:07 AM

All replies

  • there can be many reasons for this. Rather than guessing which of them caused the problem, as in most of javascript problems, start from simple alert('123'); (also remove <!-- -->) from your web part. When it will work go further. I would not recommend to directly override onload event handler - try to use jquery ready handler instead. Also check the following forum thread: Javascript onload event in sharepoint aspx page which says that sometimes it is not possible to override this method directly.


    Blog - http://sadomovalex.blogspot.com
    CAML via C# - http://camlex.codeplex.com
    Monday, August 08, 2011 1:36 PM
  • Sadomovoalex,

    thanks for the suggestion.i  have implemented the the sign in page as appln page as pop up window using the below                                                   -    called the registerstartupscript  method, & called my js file's [/_layouts/myprojfolder/scripts/mydialog.js] custom  function "ophen endialog() " ,and  used window.open() to poup up the window.  But ,now i am facing the issue of close this dialog window.after successfull signin the  user should  redirect to the  web part page.so, if i use window.opener.reload(true);window.close()  for closing the child window and i want to refresh the parent window[ which is the web part page]throws me the error undefined or null object. i am stuck here.

    i am unable to  get the  parent page  url.also, i have to get the webpart page dynamically, if i use httpcontext.current.request.url.absoluteuri it throws the  error.  i would like to know how can i get the  parent page url in the  child pop up window's code behind [appln page's code behind].

    or  should i try with the  ajaxcontroltoolkit's modal popup xtender control.? can we use the  ajaxcontroltoolkit dll in the production env.,is  that recommmended  by MSFT? \

    if yes,i need to ajaxify the  MOSS 2007 env.[64bit].i am unsure abt the ajaxify.moss.wsp file  for the x64 .

    help is appreciated.

     

     

    thnx again for the help.


    trutrutr
    Tuesday, August 09, 2011 4:00 PM
  • For Ajaxify the production environment, I think it is better develop your own Feature to add entry in Web.Config. you can test it at first at your dev environment and then deploy it on production. before that be sure which version of AJAX is install on production and then use save version in your dev environment. It is better and safe idea.

     

    Jayant


    Jayant Sharma
    Wednesday, August 10, 2011 6:07 AM