i




 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Open Popup in javascript asp.net
08-31-2010, 02:40 PM (This post was last modified: 08-31-2010 03:17 PM by nisar87.)
Post: #1
Open Popup in javascript asp.net
Javascript to open popup with user defined size
Code:
function windowOpener(windowHeight, windowWidth, windowName, windowUri)
        {
         var centerWidth = (window.screen.width - windowWidth) / 2;
         var centerHeight = (window.screen.height - windowHeight) / 2;

         newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth +
        ',height=' + windowHeight +
        ',left=' + centerWidth +
        ',top=' + centerHeight);

        newWindow.focus();
        return newWindow.name;
       }

Call javascript
Code:
<a href = "#" title="click to view detail" onclick="windowOpener(300,500,'UserDetail','UserDetail.aspx');">Detail</a>




[Image: 2604595733.png]
Quote
09-24-2010, 12:12 PM
Post: #2
RE: Open Popup in javascript asp.net
Nice and useful post Nisar.

Please give reputation if my answer/post is useful for you
Best Regards
Arti Gupta
Quote
09-24-2010, 12:31 PM
Post: #3
RE: Open Popup in javascript asp.net
Nice !!!

How can we pass query string in the popup and Close it ???

Cheers!!!!!!
Rajesh Kumar Parbat
Quote
09-24-2010, 12:48 PM
Post: #4
RE: Open Popup in javascript asp.net
to pass query string
Code:
<a href = "#" title="click to view detail" onclick="windowOpener(300,500,'UserDetail','UserDetail.aspx?id=123');">Detail</a>

on userDetail page_load event
Code:
string id=Request.QueryString["id"];
now you can use id for further implementation

to close page
Code:
//adjust below line some where in popup according to your interface design
<a href = "#" title="close" onclick="windows.close();">Close</a>

[Image: 2604595733.png]
Quote
12-27-2011, 09:19 AM
Post: #5
RE: Open Popup in javascript asp.net
Some more sample code for javascript popup.
Code:
var msgWindow = null;
       function showFileView(iId)
       {
            msgWindow = window.open("FileContentView.aspx?fileid="+iId, "tinyWindow", 'status=1, resizable=1, scrollbars=0, width=650,height=480');
            msgWindow.focus();
           if(!msgWindow.closed)
           {
            if(navigator.appName == "Netscape")
                msgWindow.location.refresh;
            else
              msgWindow.location.reload(true);  
            msgWindow.focus();
          }
       }
Quote


Possibly Related Threads...
Thread: Author Replies Views: Last Post
  Jquery fancy popup in asp.net nisar87 4 11,472 07-12-2012 03:04 PM
Last Post: dileep2024
  Bubble popup in Javascript haider.ali 5 7,032 03-04-2012 08:04 PM
Last Post: raju
  Disable copy paste right click using javascript in asp.net textbox rajesh9147 0 3,628 11-23-2011 12:09 PM
Last Post: rajesh9147
  Google Virtual Keyboard API with javascript asp.net nisar87 0 8,473 07-31-2011 11:32 AM
Last Post: nisar87
  Full screen popup in javascript nisar87 0 5,558 07-08-2011 04:42 PM
Last Post: nisar87



User(s) browsing this thread: 1 Guest(s)