473,399 Members | 2,146 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,399 software developers and data experts.

Open New Window and ASP .NET Style Question

jm
I wanted to do something simple. I wanted to open a new window with a
button. Went around the world on Google and found:

Dim endStr As String = "</"
Dim strJScript As String

strJScript = "<script language=""JavaScript"">"
strJScript += "<!-- " + vbCrLf
strJScript += "window.open
(""AddRowCall.aspx"",""myWindow"",""top=0,left=0,w idth=790,height=500,buttons=no,scrollbars=yes,loca tion=no,menubar=no,resizable=no,status=no,director ies=no,toolbar=no"");"
+ vbCrLf
strJScript += "// -->"
strJScript += endStr + "script>"

Page.RegisterClientScriptBlock("clientScript", strJScript)
Is this the way I am supposed to do this? Is there something wrong
with just creating a regular old html button (I had wanted the
asp:button, but see no benefit) and some javascript in the page? Not
to mention, this doesn't work; it just never fires. Thanks.
Nov 17 '05 #1
2 2158
Your code never fires because you never attatched it to a button.
Use Attributes.Add to do that.
Something along these lines:
MyButton.Attributes.Add("onclick",strMyClientCode)
Here's more info:
http://www.flws.com.au/showusyourcod...To.asp?catID=5

You can create an old style HTML button instead if you prefer. There is
nothing wrong with that.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"jm" <jo*************@yahoo.com> wrote in message
news:c6**************************@posting.google.c om...
I wanted to do something simple. I wanted to open a new window with a
button. Went around the world on Google and found:

Dim endStr As String = "</"
Dim strJScript As String

strJScript = "<script language=""JavaScript"">"
strJScript += "<!-- " + vbCrLf
strJScript += "window.open
(""AddRowCall.aspx"",""myWindow"",""top=0,left=0,w idth=790,height=500,button
s=no,scrollbars=yes,location=no,menubar=no,resizab le=no,status=no,directorie
s=no,toolbar=no"");" + vbCrLf
strJScript += "// -->"
strJScript += endStr + "script>"

Page.RegisterClientScriptBlock("clientScript", strJScript)
Is this the way I am supposed to do this? Is there something wrong
with just creating a regular old html button (I had wanted the
asp:button, but see no benefit) and some javascript in the page? Not
to mention, this doesn't work; it just never fires. Thanks.

Nov 17 '05 #2
Do not mix the scripts, You have specified Javascript as
the script language, and you asre also using VB constant
vbcrlf. if you mix the scripts the function will not work.
-----Original Message-----
I wanted to do something simple. I wanted to open a new window with abutton. Went around the world on Google and found:

Dim endStr As String = "</"
Dim strJScript As String

strJScript = "<script language=""JavaScript"">"
strJScript += "<!-- " + vbCrLf
strJScript += "window.open
(""AddRowCall.aspx"",""myWindow"",""top=0,left=0,w idth=790,
height=500,buttons=no,scrollbars=yes,location=no,m enubar=no
,resizable=no,status=no,directories=no,toolbar=no" ");"+ vbCrLf
strJScript += "// -->"
strJScript += endStr + "script>"

Page.RegisterClientScriptBlock("clientScript", strJScript)

Is this the way I am supposed to do this? Is there something wrongwith just creating a regular old html button (I had wanted theasp:button, but see no benefit) and some javascript in the page? Notto mention, this doesn't work; it just never fires. Thanks..

Nov 17 '05 #3

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

Similar topics

4
by: Phillip Parr | last post by:
Hello, I have a nice system where someone clicks on a picture to show the full version. This pops up in a window.open box. It works great, the only problem is that if the user clicks a second...
4
by: Dan Cruz | last post by:
Below are two files: Main.asp and Help.asp. I've stripped it down to the 'barest-of bones' so that anyone willing to help can duplicate the problem on their own systems. ***Main.asp*** looks...
8
by: alanstew | last post by:
With the body tag calling out 'window onload', a function with a 'window.open' fails at the 'window.open' line. If I cut out the body tag, the function executes as normal. At first I thought it...
3
by: unurban | last post by:
I have a javascript menu based off of unordered lists that only shows the subnav links when you click on the main nav links. is there a way to keep any subnav items open after you click on a link...
18
by: Roger Withnell | last post by:
I open a new window from the current window to display maps. Several maps of different sizes can be displayed. The function is given the size of the map and adjusts the window size accordingly....
2
by: KathyB | last post by:
Hi, In the pageload of my aspx file I have the following (in both not in postback and is postback)... btnList.Attributes.Add("onclick", "window.open('Scanned.aspx', 'Serial Numbers',...
4
by: ad | last post by:
I used Response.Redirect(sUrl); to open another .aspx But I want to open it in another browser like target="_blank" How can I do that?
2
by: Francesco | last post by:
Hi, got a problem, hope someone could help: this function should open a popup showing an image automatically adjusting browser window's height and width. It works fine with IE6 but not with...
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: 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: 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,...
0
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...
0
tracyyun
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...

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.