Netnoobie Posted February 12, 2003 Posted February 12, 2003 Hello all! Have an ASPX page that really should be called in a pop up window. How can I call a pop up window from .NET? I can't seem to find much on it anywhere, and need to use this functionality throughout this project. Many thanks! Quote
Moderators Robby Posted February 12, 2003 Moderators Posted February 12, 2003 You can create a new aspx file (maybe call it Popup) and in the calling form put some javascript. Sorry I only know how to do it with JS <SCRIPT> function fnOpenPopup(sPage,sArgs,sFeatures,bMode) { if (bMode == 'Modal') window.showModelessDialog(sPage, sArgs, sFeatures); else window.open(sPage, sArgs, sFeatures); } </SCRIPT> If you want to use this method I'll give you the parameters required. Quote Visit...Bassic Software
Netnoobie Posted February 13, 2003 Author Posted February 13, 2003 Yeah actually I would like to try that method, please post the parameters. Thanks Robby. Quote
Moderators Robby Posted February 13, 2003 Moderators Posted February 13, 2003 You can play around with the Features to suite your needs... Dim sURL As String = "Your_Popup.aspx?SomeString=" Dim sArgs As String = "someargsServiceDefinitions" Dim sFeaturesModeless As String = "menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,width=800,height=400" Dim sFeaturesModal As String = "dialogHeight:500px;dialogWidth:500px;dialogTop:100px;dialogLeft:100px;edge:Raised;center:1;help:0;resizable:1;status:0;scroll:1" Dim sMode As String = "Modal" Quote Visit...Bassic Software
Moderators Robby Posted February 13, 2003 Moderators Posted February 13, 2003 Oh yeah, to call it from an <a href>.... "<a href=javascript:fnOpenPopup('" & sURL & "','" & sArgs & strArray(intCounter, 1) & "','" & sFeaturesModeless & "','" & sMode & "')>Some Text</a>" Quote Visit...Bassic Software
Netnoobie Posted February 13, 2003 Author Posted February 13, 2003 Ok, now this will show just how new I am to NET. How can I use the code you've given me with codebehind? In my code I've set the HREF like: Link1.NavigateUrl = "java script:fnOpenPopup('" & sURL & "','" & sFeaturesModeless & "','" & sMode & "')" With the <SCRIPT> tags in the aspx page. The variables are being populated so that's not a problem. Here's what is in the propeties of the link at runtime: [url]http://localhost/Citadel/java%20script:fnOpenPopup[/url]('AddNewLocation.aspx','%20menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,width=800,height=400','Modal') So it's sticking the string at the end of the //localhost URL. What is the way around this? Just trying to wade through this NET stuff. Many Thanks. Quote
Moderators Robby Posted February 13, 2003 Moderators Posted February 13, 2003 You don't need the //localhost or URL, all you need is the name of you ASPX file (in the sURL) Quote Visit...Bassic Software
Netnoobie Posted February 14, 2003 Author Posted February 14, 2003 Yeah I did that, it's just putting it in there by default. Is there a way to change that you think? Thanks! Quote
Netnoobie Posted February 14, 2003 Author Posted February 14, 2003 Actually, I got it. Some stupid thing on my part. Thanks again for your help Robby. Quote
TheWizardofInt Posted February 18, 2003 Posted February 18, 2003 How would you do this with the code behind method? I find that when I click a button, it kicks off the page.ispostback bing true and sends me back to the login page If I page through that and force the button click event, then it doesn't see Window as a valid object Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
Netnoobie Posted February 18, 2003 Author Posted February 18, 2003 I sort of streamlined (for my testing purposes at least) what was given to me. This is in the aspx header: <SCRIPT> function fnOpenPopup(sPage,sFeatures,bMode) { window.open(sPage, 'NewWin', sFeatures) } </SCRIPT> And this give the link the URL: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then BindDDL() End If Link1.NavigateUrl = "javascript:fnOpenPopup('AddNewLocation.aspx','menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,width=375,height=250,left=401,top=250','Modal')" End Sub Of course I'm using a Hyperlink, but it's the same idea. Quote
TheWizardofInt Posted March 9, 2003 Posted March 9, 2003 I am trying to use this code. Where are you getting Link1 from, to do Link1.NavigateUrl? Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
Moderators Robby Posted March 10, 2003 Moderators Posted March 10, 2003 I'm guessing that Link1 is a LinkLabel drawn on the page Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.