473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Open new browser window in ASP.net. What i am doing wrong?

Hello,

i want to open a new window when a button is clicked. I am working in
ASP.net / VB. However my code is not working.

This is my Script Code:

<script runat="server">

Private Sub openNewWindow(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Response.Write("<script>window.open 'http://www.google.com', '_new',
'width=400, height=200, status=no, toolbar=no, menubar=no, location=no');
</script>")
End Sub

</script>

and this is my Button Code:

<asp:Button CssClass="button" ID="buttonID" runat="server" Text="Go"
onClick="openNewWindow"/>

Can you tell me what am i doing wrong?

Thank You,
Miguel

Nov 18 '05 #1
2 1817
use an html button, not an asp control
use the onClick then

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Miguel Dias Moura" <in************@27lamps.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

i want to open a new window when a button is clicked. I am working in
ASP.net / VB. However my code is not working.

This is my Script Code:

<script runat="server">

Private Sub openNewWindow(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Response.Write("<script>window.open 'http://www.google.com', '_new',
'width=400, height=200, status=no, toolbar=no, menubar=no, location=no');
</script>")
End Sub

</script>

and this is my Button Code:

<asp:Button CssClass="button" ID="buttonID" runat="server" Text="Go"
onClick="openNewWindow"/>

Can you tell me what am i doing wrong?

Thank You,
Miguel

Nov 18 '05 #2
you should to use <script language='JavaScript'> instead of <script>

right?

best regards,
Marcos
"Miguel Dias Moura" <in************@27lamps.com> escreveu na mensagem
news:#d**************@TK2MSFTNGP09.phx.gbl...
Hello,

i want to open a new window when a button is clicked. I am working in
ASP.net / VB. However my code is not working.

This is my Script Code:

<script runat="server">

Private Sub openNewWindow(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Response.Write("<script>window.open 'http://www.google.com', '_new',
'width=400, height=200, status=no, toolbar=no, menubar=no, location=no');
</script>")
End Sub

</script>

and this is my Button Code:

<asp:Button CssClass="button" ID="buttonID" runat="server" Text="Go"
onClick="openNewWindow"/>

Can you tell me what am i doing wrong?

Thank You,
Miguel

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
6
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...
10
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#"...
4
by: Ian Sedwell | last post by:
Hi guys The following code works just fine in Netscape on MacOS and Windows. But in Explorer on MacOS and Windows it throws a type mismatch error at the point marked with the comment ³// bug out...
3
by: Bob | last post by:
I am trying to create a popup page (to act as a menu) from a parent page. When the parent page (index.jsp) calls my popup function (see below) it will properly open the correct size browser window...
6
by: Mateo | last post by:
Hi! I tried to open page in new window with window.open(...) method. open() method supports fullscreeen mode, but I would like to open new maximized window with tiltle bar only.... Any idea...
2
by: Miguel Dias Moura | last post by:
Hello, i want to open a new window when a button is clicked. I am working in ASP.net / VB. However my code is not working. This is my Script Code: <script runat="server"> Private Sub...
1
by: Sam | last post by:
I have 2 jsp pages which are loaded from the same browser window. Inside these jsp pages, I have created 2 windows to write client side log. I have used different id for 2 windows as follow. In...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.