Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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!

  • Moderators
Posted

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.

Visit...Bassic Software
  • Moderators
Posted

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"

Visit...Bassic Software
  • Moderators
Posted

Oh yeah, to call it from an <a href>....

"<a href=javascript:fnOpenPopup('" & sURL & "','" & sArgs & strArray(intCounter, 1) & "','" & sFeaturesModeless & "','" & sMode & "')>Some Text</a>"

Visit...Bassic Software
Posted

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.

Posted

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

Read the Fovean Chronicles

Because you just can't spend your whole day programming!

Posted

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.

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...