Hi,
I have a asp:button btnGo. When clicking this button,
the code will parse a asp:table to find a specific ID
under certain conditions. Once the ID is found, the code
need to keep the current page open and to redirect the
user to a newly opened browser window with a link like:
http://www.mydomain.com/tellme.aspx?clientID="+ID
But the Response.Redirect(URL) opens a new page in the same
window.
Someone suggested to insert a JavaScript function to button's
OnClick event. But this insertion needs to be done in Page_Load().
And the parameter the target url needs is not available yet at
page load time.
If I insert the window.open() JavaScript in btnGo_Click() event,
the window.open JavaScript will only be available after first click
event.
I also thought of asp:hyperlink control. It does have a target property
and can not fire any event on server side.
Would you please give some work around idea regarding what I
want to do?
Thank you
hb 3 29092
current browser security settings require that a window only be opened from
href with a target, or client script tied to a onclick event. this prevents
the old trick of spewing inline javascript to open the window.
you need to find another approach. you should pass the id down in the
original render, and have client script determine the correct value, or just
render a link the user clicks on to open the window.
-- bruce (sqlwork.com)
"hb" <ho****@goodoffices.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
| Hi,
|
| I have a asp:button btnGo. When clicking this button,
| the code will parse a asp:table to find a specific ID
| under certain conditions. Once the ID is found, the code
| need to keep the current page open and to redirect the
| user to a newly opened browser window with a link like:
| http://www.mydomain.com/tellme.aspx?clientID="+ID
|
| But the Response.Redirect(URL) opens a new page in the same
| window.
|
| Someone suggested to insert a JavaScript function to button's
| OnClick event. But this insertion needs to be done in Page_Load().
| And the parameter the target url needs is not available yet at
| page load time.
|
| If I insert the window.open() JavaScript in btnGo_Click() event,
| the window.open JavaScript will only be available after first click
| event.
|
| I also thought of asp:hyperlink control. It does have a target property
| and can not fire any event on server side.
|
| Would you please give some work around idea regarding what I
| want to do?
|
| Thank you
|
| hb
|
|
I see. Thank you.
hb
"bruce barker" <no***********@safeco.com> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl... current browser security settings require that a window only be opened
from href with a target, or client script tied to a onclick event. this
prevents the old trick of spewing inline javascript to open the window.
you need to find another approach. you should pass the id down in the original render, and have client script determine the correct value, or
just render a link the user clicks on to open the window.
-- bruce (sqlwork.com)
"hb" <ho****@goodoffices.com> wrote in message news:uV**************@TK2MSFTNGP09.phx.gbl... | Hi, | | I have a asp:button btnGo. When clicking this button, | the code will parse a asp:table to find a specific ID | under certain conditions. Once the ID is found, the code | need to keep the current page open and to redirect the | user to a newly opened browser window with a link like: | http://www.mydomain.com/tellme.aspx?clientID="+ID | | But the Response.Redirect(URL) opens a new page in the same | window. | | Someone suggested to insert a JavaScript function to button's | OnClick event. But this insertion needs to be done in Page_Load(). | And the parameter the target url needs is not available yet at | page load time. | | If I insert the window.open() JavaScript in btnGo_Click() event, | the window.open JavaScript will only be available after first click | event. | | I also thought of asp:hyperlink control. It does have a target property | and can not fire any event on server side. | | Would you please give some work around idea regarding what I | want to do? | | Thank you | | hb | |
After intensive searching online, I found a way to open a new browser window
in button click event. Instead of using Response.Redirect(), use
Response.Write()
to add a javascript code to the page. Here it is:
btnPack_Click(object sender, System.EventArgs e)
{
string orderID1=((Button)sender).ID;//get the button's ID
//some data processing
Response.Write("<script
language=javascript>window.open('/pack.aspx?slipOrderID="+orderID1
+"',
win','toolbar=0,location=0,directories=0,status=1, menubar=1,scrollbars=1,res
izable=1,"
+"width=600,height=600');</script>");
}
Note: the Response.Write() needs to be placed at the bottom of
btnPack_Click(). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Leonard |
last post by:
I have a button on my web app, that opens a help html page. I use this code:
HttpContext.Current.Response.Write("<script>")
HttpContext.Current.Response.Write("window.open('" & sUrl & "','_new')")...
|
by: J Gao |
last post by:
Hi, experts,
On a button click, I need to save some data to the session object. Then open
a new window. The new window will use the session data saved in the first
window. I don't want use to...
|
by: Shamin |
last post by:
Hi,
Thanks in advance for answering to my Question. I'm stuck with this
problem and would really appreciate any help.
I have 2 aspx files (Main.aspx and ReportViewer.aspx). Main.aspx has a...
|
by: Jorge Ponte |
last post by:
hi
I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In
that WUC I want have a textbox and a button. I want to click on the button
and open a popup (I use javascript for...
|
by: rbutch |
last post by:
hey guys i've got a question as to why something is happening.
basically building a web application, and i want to open up another .aspx form, but not
close the one i have.
so, i assign a...
|
by: Jack |
last post by:
Hi,
How do I open a new window in a button click event (server-side)?
I need to open it from this event because once the user has click the
button, the event handler does some processing and...
|
by: carlor |
last post by:
Hi there,
I have a form that contains a link button. When the user clicks the link
button I need to enable a couple of other buttons on the page and open a new
browser window giving it focus...
|
by: shil |
last post by:
I have a server side button that needs to do some preperation and
afterwards, if everything goes well, open a new browser with a specific
url.
I know how to execute javascript from a server side...
|
by: nashak |
last post by:
Hello,
I have a aspx page on which I have a button. In the click event method
in code-behind I do some processing and now need to open a new window
in another browser and pass a couple of...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |