Hi all, how do I open a javascript window from a code behind page?
I was using
Response.Write( "<script
language='javas cript'>window.o pen('url','name ','options');</script>")
but now for some reason it is not working..
Thanks in advance
Mark 5 3393
Hi Mark,
You can try this....
After your form tag in your aspx file type the folloowing
......
</form>
<script language="javas cript">
<asp:literal runat="server" id="ltScript"> </asp:literal>
</script>
In your code behind do the following
Literal ltScript = (Literal) Page.FindContro l("ltScript") ;
ltScript.Text = "window.open('h ttp://MyURL/MyPage.aspx','n ame','options') ;"
Regards
Ganesh
"Mark" <ma**@Z-Zvolution.nZt> wrote in message
news:cl******** **@lust.ihug.co .nz... Hi all, how do I open a javascript window from a code behind page? I was using
Response.Write( "<script language='javas cript'>window.o pen('url','name ','options');</script>")
but now for some reason it is not working.. Thanks in advance Mark
Hi Ganesh, thanks for that info. I tried it but it is still not working. It
must be a problem with my spyware / browser setup stopping scripts as your
code looks fine.
Thanks again
Mark
--
"Ganesh Ramamurthy" <ga****@kottsof tware.com> wrote in message
news:uy******** ******@TK2MSFTN GP14.phx.gbl... Hi Mark,
You can try this....
After your form tag in your aspx file type the folloowing
..... </form> <script language="javas cript"> <asp:literal runat="server" id="ltScript"> </asp:literal> </script>
In your code behind do the following
Literal ltScript = (Literal) Page.FindContro l("ltScript") ; ltScript.Text =
"window.open('h ttp://MyURL/MyPage.aspx','n ame','options') ;" Regards Ganesh
"Mark" <ma**@Z-Zvolution.nZt> wrote in message news:cl******** **@lust.ihug.co .nz... Hi all, how do I open a javascript window from a code behind page? I was using
Response.Write( "<script language='javas cript'>window.o pen('url','name ','options');</script>")
but now for some reason it is not working.. Thanks in advance Mark
Hi Mark,
Check if you have any popup blocker installed in your browser. Also winxp
service pack 2 comes with a popup blocker.
HTH
srini
"Mark" wrote: Hi all, how do I open a javascript window from a code behind page? I was using
Response.Write( "<script language='javas cript'>window.o pen('url','name ','options');</script>")
but now for some reason it is not working.. Thanks in advance Mark
are you able to do the same using plain Javascript??
"Mark" <ma**@Z-Zvolution.nZt> wrote in message
news:cl******** **@lust.ihug.co .nz... Hi Ganesh, thanks for that info. I tried it but it is still not working.
It must be a problem with my spyware / browser setup stopping scripts as your code looks fine.
Thanks again Mark --
"Ganesh Ramamurthy" <ga****@kottsof tware.com> wrote in message news:uy******** ******@TK2MSFTN GP14.phx.gbl... Hi Mark,
You can try this....
After your form tag in your aspx file type the folloowing
..... </form> <script language="javas cript"> <asp:literal runat="server" id="ltScript"> </asp:literal> </script>
In your code behind do the following
Literal ltScript = (Literal) Page.FindContro l("ltScript") ; ltScript.Text = "window.open('h ttp://MyURL/MyPage.aspx','n ame','options') ;" Regards Ganesh
"Mark" <ma**@Z-Zvolution.nZt> wrote in message news:cl******** **@lust.ihug.co .nz... Hi all, how do I open a javascript window from a code behind page? I was using
Response.Write( "<script language='javas cript'>window.o pen('url','name ','options');</script>")
but now for some reason it is not working.. Thanks in advance Mark
Hi Mark,
i had the same problem as you and I found a little workaround...
just add a normal <asp:Button id=someButton runat=server></asp:Button>
in code behind
on the page load add this line
this.someButton .Attributes.Add ("onClick",
"window.open('p opupwindow.aspx ','WindowName', 'toolbar=0,scro llbars=1,locati on=0,statusbar= 1,menubar=0,res izable=1,width= 640,height=425' );");
now the flow that happens is ..
1) the popup window is openened ...
2) the code behind for the first page is triggered
you can add <body onload="window. focus()"> to the body onload event of
your popup but the first page will be on top even with this code.
a workaround for this is to add this piece of javascript
<body onload="window. focus()" onblur="blurEve nt()">
<script language="javas cript">
var count = 0;
function blurEvent()
{
if(count == 0)
self.focus();
count = count + 1;
}
</script>
downside :
if the postback triggered stuff thats write to session or database ..
it will not be accessible on the first pageload of your popup page.
but you could adapt the blurEvent() function so it postsback the first
real load ... (count == 1)
Is it a nifty or nasty workaround ... i'll leave that up to you, but
it did help me out :)
Greets,
Tom This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lukeo |
last post by:
I'm shelling out to an .asp (or htm) page from an application. I want
to show this in a window without the address bar, etc...
Is there a way I can redirect this page using javascript to a page
where I can set the window height, statusbar=no, etc?
Thanks,
-Luke
|
by: Nevyn Twyll |
last post by:
I have a DataList; in the DataList's , I have a LinkButton
and a few listboxes.
When the LinkButton is pressed, I need to get the ID of the selected item in
one of the Listbox controls.
Then I want to launch another web page in a seperate window, using that ID.
In the header of the web page, I have a javascript function
LaunchMyWindow(iID) that launches that window.
For a normal LinkButton Control, I could just use
|
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 click two buttons, one to save the session data
and the other one to trigger the java script to open the new window. Your
advice is highly appreciated.
Jie
|
by: mg |
last post by:
window.open (URLTarget, windowName,
height=720,width=975,resizable=yes, ...
lets me open a new WebForm with a specified size using
JavaScript.
Is there a way of doing this from code behind; something
like
if (rbX.Checked == true)
|
by: Chris |
last post by:
I know this is a dead horse I'm beating but why is it so impossible to ask
for functionality in the HTML tag to open a window/page more controllable?
why is:
<a href="somepage.aspx?value1=xyz" target="_blank">click here</a>
can't be:
<a href="somepage.aspx?value1=xyz" pagewidth="500px or %" page height="500px
or %" target="_blank">click here</a>
then what about in the code behind using:
response.redirect("somepage.aspx?value1=xyz",...
| |
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 (keeping it on top). I have most of it working
but I can't get it all working. I can either have the window open and disable
the buttons with the new window in the background, or I can have the new
window in the foreground but not be able to disable...
|
by: loga123 |
last post by:
I am using asp .net 2.0. I have a hyperlink asp control on my web page
page1.aspx.
On clicking this hyper;link, I would like to open page2.aspx (which is
in the same web application) in a new IE window without scrollbars,
status bar, tool bar and with specified height and width.
Can it be done on "onload" event of the page2.aspx in javascript?
|
by: rockdale |
last post by:
Hi, all:
I have a linkbutton and I use javascript to open another webpage in a
new window. I also want to set my session variable value when this
linkbutton get clicked. These session variable is used in the the
webpage that in the new window. I do not want pass these variables as
parameters to the web page. Can I let the linkbutton execute postback
to set the session variable's value and also execute client javascript
to open a new...
|
by: bushi |
last post by:
hi everyone!
i have diplayed my hyperlinks in a iframe.when i redirect
to next page.the next page also open in the same frame,but i want to
open a new browser window,when i click on the link.actually i 'm using
link button control to diplay the hyperlinks.i cant use java script
"window.open()".i need some server side code behind the linkbutton,if
any one knows plz rply soon.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |