473,587 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New window from dropdown list

Hi,

I'm trying to open a new window to bring up an external link once a value
is selected from a drop down list. I'm trying the following but I get the
error:

'If' must end with a matching 'End If'
Sub State_SelectedI ndexChanged(sen der As Object, e As EventArgs)

If State.SelectedI tem.Value="CT" Then
Response.Write( "<script>window .open("PageName .aspx")</script>")
End if
End Sub

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
5 1395
Hello Jeff via DotNetMonster.c om,

This may have to do with the quoting issue:

Try:

Response.Write( "<script>window .open('PageName .aspx')</script>")

Notice the ' instead of ". I think using VB you can get the " character in
there by using "".

Response.Write( "<script>window .open(""PageNam e.aspx"")</script>")

--
Matt Berther
http://www.mattberther.com
Hi,

I'm trying to open a new window to bring up an external link once a
value is selected from a drop down list. I'm trying the following but
I get the error:

'If' must end with a matching 'End If'

Sub State_SelectedI ndexChanged(sen der As Object, e As EventArgs)

If State.SelectedI tem.Value="CT" Then

Response.Write( "<script>window .open("PageName .aspx")</script>")
End if
End Sub


Nov 19 '05 #2
Thanks. I tried both but it still didn't work.

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #3
Hello Jeff via DotNetMonster.c om,

Are you sure that the line you posted is the one generating the error?

--
Matt Berther
http://www.mattberther.com
Thanks. I tried both but it still didn't work.


Nov 19 '05 #4
Yes. Does anything need to be defined in the header of the page? It looks
like the ending script tag </script> is closing the <script runat="server">
because it doesn't recognize my other function.
This is what I have:

<script runat="server">
Sub State_SelectedI ndexChanged(sen der As Object, e As EventArgs)
If State.SelectedI tem.Value="AK" Then
Response.Write( "<script>window .open
(""http://www.eed.state.a k.us/contentStandard s/"")</script>")
End If
End Sub

This is the compiler output:
error BC30081: 'If' must end with a matching 'End If'.

If State.SelectedI tem.Value="AK" Then
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
C:\Inetpub\wwwr oot\web\pd\ELLC ourses2.aspx(12 ) : error BC30648: String
constants must end with a double quote.

Response.Write( "<script>window .open
(""http://www.eed.state.a k.us/contentStandard s/"")

~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~
C:\Inetpub\wwwr oot\web\pd\ELLC ourses2.aspx(18 2) : error BC30451: Name
'GetLinks' is not declared.

target.DataSour ce = CType(GetLinks( ),Object)
~~~~~~~~
C:\WINNT\Micros oft.NET\Framewo rk\v1.1.4322\Te mporary ASP.NET Files\root\
54f85d9e\82f89d a3\v4gskhug.0.v b(424) : error BC30289: Statement cannot
appear within a method body. End of method assumed.

Public Sub New()
~~~~~~~~~~

Thanks so much

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #5
Hello Jeff via DotNetMonster.c om,

I think your assumption that the </script> portion of your Response.Write
is closing the wrong tag is correct. Unfortunately, VB is not my primary
language, so Im just making some guesses here:

1. Is the entire contents of the Response.Write on the same line?
2. Do you get the same error when you replace the "" with ' (ie: Response.Write( "<script>window .open('http://www.eed.state.a k.us/contentstandard s/')</script>")
--
Matt Berther
http://www.mattberther.com
Yes. Does anything need to be defined in the header of the page? It
looks
like the ending script tag </script> is closing the <script
runat="server">
because it doesn't recognize my other function.
This is what I have:
<script runat="server">
Sub State_SelectedI ndexChanged(sen der As Object, e As EventArgs)
If State.SelectedI tem.Value="AK" Then
Response.Write( "<script>window .open
(""http://www.eed.state.a k.us/contentStandard s/"")</script>")
End If
End Sub
This is the compiler output:
error BC30081: 'If' must end with a matching 'End If'.
If State.SelectedI tem.Value="AK" Then
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~
C:\Inetpub\wwwr oot\web\pd\ELLC ourses2.aspx(12 ) : error BC30648: String
constants must end with a double quote.

Response.Write( "<script>window .open
(""http://www.eed.state.a k.us/contentStandard s/"")

~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~
C:\Inetpub\wwwr oot\web\pd\ELLC ourses2.aspx(18 2) : error BC30451: Name
'GetLinks' is not declared.

target.DataSour ce = CType(GetLinks( ),Object)
~~~~~~~~
C:\WINNT\Micros oft.NET\Framewo rk\v1.1.4322\Te mporary ASP.NET
Files\root\
54f85d9e\82f89d a3\v4gskhug.0.v b(424) : error BC30289: Statement cannot
appear within a method body. End of method assumed.

Public Sub New()
~~~~~~~~~~
Thanks so much


Nov 19 '05 #6

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

Similar topics

10
14698
by: Scott | last post by:
I'm new to ASP, but I've been programming in VB for several years, and I'm having a few issues with this ASP enhancement I'm working on. I've found ASP to be a lot different than what I'm use to in VB. I've created an ASP interface where a user can select an email group that populates a listbox with those email addresses. If a user sees...
1
8273
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two dropdown lists. If you change the selection of the left one (e.g. choose parentoption2), it should open up page2.htm in a popup window.
3
2470
by: Dave | last post by:
We are developing a web page that shows large graphics. To provide more screen space for the graphics, we allow the user to popup a window that places itself over the top part of the browser. This popup contains a control panel that tells the main window what to display. Because we don't want to require that the user continually ALT-TAB to...
2
3802
by: Bostonasian | last post by:
I am trying to append options to dropdown in parent window from option items in child window. In parent window, I have following code: <script language="javascript"> function AddItem2DropDown(item){ exists = false; for(d=0;d<drpDwn.length;d++){ if(drpDwn.options.value == item.value)
2
4541
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am...
3
1108
by: rgparkins | last post by:
Hi, Really stuck with this one, or the fact that I have just had a baby maybe mind mind is in meltdown and I cant figure how to solve this! I have a list of users stored in session. These users are displayed in a list on the admin web page and I would like to give the administrator a dropdown of actions on this list. For example, print...
3
3515
by: er1 | last post by:
Hi all, I have created a double dropdown list. Based on the first list selection, second list populates (this works fine). I have a submit button, which when clicked should run a select query based on the values selected on both the dropdown lists. But this part is not working. It picks up right value for the first dropdown list and always...
1
1567
by: bwarhold | last post by:
i need to have these links open into a new window and can't figure out how. any help would be greatly appreciated. Thanks, b
40
2949
by: bhappy | last post by:
Hai all, Is any body know ajax?
1
1307
by: ckb | last post by:
Hi, I have an html page that has a javascript function that populates a dropdown list on the main html page. Ihave written a function that opens up a new window on a button click on the main window using OpenWindow=window.open("", "newwin", "height=350, width=350,toolbar=no,scrollbars=no,menubar=no");...
0
7920
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, 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...
0
8347
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
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...
0
6626
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
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...
0
3844
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...
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
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...

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.