By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,786 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,786 IT Pros & Developers. It's quick & easy.

PopUp Window from Codebehind

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
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" <am****@yahoo.com> wrote in message
news:b2**************************@posting.google.c om...
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.

Nov 18 '05 #2

P: n/a
I saw Frank Gimberg do something similar to this in a demo once a year or
two ago. You can contact him at fr***@prosoft-sys.com
"Rathtap" <am****@yahoo.com> wrote in message
news:b2**************************@posting.google.c om...
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.

Nov 18 '05 #3

P: n/a
while you can emit javascript to do this, any popup blocker will stop it.

-- bruce (sqlwork.com)
"Rathtap" <am****@yahoo.com> wrote in message
news:b2**************************@posting.google.c om...
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.

Nov 18 '05 #4

P: n/a
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" <am****@yahoo.com> wrote in message
news:b2**************************@posting.google.c om...
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.

Nov 18 '05 #5

P: n/a
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" <no***********@safeco.com> wrote in message
news:ed**************@TK2MSFTNGP15.phx.gbl...
while you can emit javascript to do this, any popup blocker will stop it.

-- bruce (sqlwork.com)
"Rathtap" <am****@yahoo.com> wrote in message
news:b2**************************@posting.google.c om...
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.


Nov 18 '05 #6

P: n/a
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/ShowCon...9-6f952f31491a

Greg

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oe*************@TK2MSFTNGP11.phx.gbl...
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" <no***********@safeco.com> wrote in message
news:ed**************@TK2MSFTNGP15.phx.gbl...
while you can emit javascript to do this, any popup blocker will stop it.

-- bruce (sqlwork.com)
"Rathtap" <am****@yahoo.com> wrote in message
news:b2**************************@posting.google.c om...
> 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.



Nov 18 '05 #7

P: n/a
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" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:O7**************@TK2MSFTNGP15.phx.gbl...
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/ShowCon...9-6f952f31491a

Greg

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oe*************@TK2MSFTNGP11.phx.gbl...
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" <no***********@safeco.com> wrote in message
news:ed**************@TK2MSFTNGP15.phx.gbl...
while you can emit javascript to do this, any popup blocker will stop
it.

-- bruce (sqlwork.com)
"Rathtap" <am****@yahoo.com> wrote in message
news:b2**************************@posting.google.c om...
> 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.



Nov 18 '05 #8

P: n/a
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:uZ**************@TK2MSFTNGP15.phx.gbl...
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" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:O7**************@TK2MSFTNGP15.phx.gbl...
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/ShowCon...9-6f952f31491a

Greg

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oe*************@TK2MSFTNGP11.phx.gbl...
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" <no***********@safeco.com> wrote in message
news:ed**************@TK2MSFTNGP15.phx.gbl...
while you can emit javascript to do this, any popup blocker will stop
it.

-- bruce (sqlwork.com)
"Rathtap" <am****@yahoo.com> wrote in message
news:b2**************************@posting.google.c om...
> 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.



Nov 18 '05 #9

P: n/a
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/p...2/default.aspx

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

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:#i**************@TK2MSFTNGP15.phx.gbl...
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:uZ**************@TK2MSFTNGP15.phx.gbl...
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" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:O7**************@TK2MSFTNGP15.phx.gbl...
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/ShowCon...9-6f952f31491a
Greg

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Oe*************@TK2MSFTNGP11.phx.gbl...
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" <no***********@safeco.com> wrote in message
news:ed**************@TK2MSFTNGP15.phx.gbl...
> while you can emit javascript to do this, any popup blocker will stop
> it.
>
> -- bruce (sqlwork.com)
>
>
> "Rathtap" <am****@yahoo.com> wrote in message
> news:b2**************************@posting.google.c om...
> > 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.
>
>



Nov 18 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.