.NETGURU
PopUp Window from Codebehind
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.

Post a new message to this list...

Rathtap
I want to popup a window from my codebehind. The reason is that during
the postback the code needs to do some validations and to build the
arguments that are passed in the url. How can I achieve this
functionality?
The reason I do not want to use Response.Redirect is because when the
user comes back to the first page, all the selections that were
made(which are the arguments) disappear.
Reply to this message...
 
    
bruce barker
while you can emit javascript to do this, any popup blocker will stop it.

-- bruce (sqlwork.com)

"Rathtap" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Kevin Spencer
Forgive me. I spoke too quickly Upon reflection, I realized that JavaScript
can't click a hyperlink. Oh well. I can't think of any other way to open a
new browser window that won't be foiled by popup blockers. Best to try
another route.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"bruce barker" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Greg Burns
Kevin,

This has been bother me for quite awhile.

Why does my code for a pop-up window from my app not get blocked by IE SP2
pop-up blocker or the Google toolbar? (Yet some other pop-up blockers that
my users have installed does block it)

(No exceptions have been made in IE's Pop-up blocker settings either)

Private Function openNewWindow(ByVal url As String, ByVal windowName As
String, ByVal features As String) As String

' url parameter must be enclosed in single quotes!!!

Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder
sb.Append("javascript:var " & windowName & " = window.open(" + url +
",'" + windowName + "','" & features + "');" & windowName & ".focus();")

Return sb.ToString()
End Function

The code is not really important here. I think I might be missing the big
picture; are pop-up allowed if they are user initiated. (i.e. a user click a
hyperlink that causes the pop-up)?

BTW, here is a great link I saw yesterday to encapsulate creating a pop-up
into a class:

http://www.dotnet2themax.com/ShowContent.aspx?ID=5f606582-4626-4c6f-a6e9-6f952f31491a

Greg

"Kevin Spencer" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Curt_C [MVP]
It's not a popup if the user clicked it, it's a link. Popups are usually
designated as loaded from within the page without the user instructing it to
do so.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com

"Greg Burns" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Greg Burns
I don't think I expressed myself well.

For example, I have button (being a hyperlink button or push button) in a
datagrid. When the user selects it, is causes a postback. In the post back
code, I am building js window.open function that I append to the output of
the page with Page.RegisterStartupScript. (I am dynamically building the
querystring). How does/should a pop-up blocker treat this situation? My
pop-up blockers are allowing it, some or not.

Greg

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Kevin Spencer
Hi Gregg,

Windows XP Service Pack 2 includes a Popup blocker. I can't tell you
anything about other popup blockers, but here is all the info about Windows
XP Service Pack 2 for developers:

http://msdn.microsoft.com/security/productinfo/xpsp2/default.aspx

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Greg Burns" <Click here to reveal e-mail address> wrote in message
news:#Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Kevin Spencer
You have a couple of options. One is to generate a JavaScript that opens the
new window. As has been pointed out, popup blockers will stop it. However,
another approach (also using JavaScript) is to programmatically click a
(hidden) hyperlink that opens in a new window, thus avoiding the popup
blockers. However, you wil have no control over the new window's size and
configuration.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Rathtap" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Dot Net Guru
I saw Frank Gimberg do something similar to this in a demo once a year or
two ago. You can contact him at Click here to reveal e-mail address

"Rathtap" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Curt_C [MVP]
there is no way to do that directly from code-behind, it has to pass to a
clientside call

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com

"Rathtap" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Text.StringBuilder
System.Web.UI.Page




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification