473,770 Members | 4,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Menu List

Hello,

I have a form page in ASP where the first menu/list function as a filter of
the second menu list. Once I select an item form the first combo I get the
second menu full of options. This is correct. My probem is that the first
combo gets the default value again and I do not see what I did choose.

I do not know if I explained this correctly. Hope someone can understand me.

Thanks a lot, Lina
Jul 22 '05 #1
8 1853
Show the code you're using to populate the first drop down and the code
you're using to retrieve that value.

Ray at work

"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message
news:99******** *************** ***********@mic rosoft.com...
Hello,

I have a form page in ASP where the first menu/list function as a filter of the second menu list. Once I select an item form the first combo I get the
second menu full of options. This is correct. My probem is that the first
combo gets the default value again and I do not see what I did choose.

I do not know if I explained this correctly. Hope someone can understand me.
Thanks a lot, Lina

Jul 22 '05 #2
This is the function code tu fill the combos, wher vector is a variable Pais
filled with a recorset.

Function ComboRS(vector)
'Pinto el combo
for i= 0 to UBound(vector, 2)
Response.Write "<option value='"& vector(0,i) &" - "& vector(1,i)&"'> "&
vector(0,i) &" - "& vector(1,i) & vbCrLf
next
End Function
%>
Here is the call to the recordset and the way I fill the variable Pais:

strPais = "select IdPais, NmPais from Paises order by NmPais"
Call OpenRS(rsPais,s trPais,ConnAxs)
Pais = rsPais.GetRows
Call CloseRS(rsPais)

If request.form("C boPais") = "" Then
CadenaPais = "57"
Else
Izquierda = instr(1,request .form("CboPais" ),"-")
CadenaPAis = Trim(Left(reque st.form("CboPai s"),Izquierd a - 1))
End If

Here is how I work out the first combo:

'<select name="cboPais" size="1" tabindex="10" onChange="submi t();">
'<option selected>-- Seleccione un PaÃ*s --
'<%Call ComboRS(Pais)%>

This is the code for the recorset of the other combo:

strCentral = "select IdProyecto, NmProyecto from Proyectos Where IdPais
='"& CadenaPais &"' AND Tecnologia = '"& TipoPlanta &"' order by NmProyecto"
Call OpenRS(rsCentra l,strCentral,Co nnAxs)
Central = rsCentral.GetRo ws
Call CloseRS(rsCentr al)

I do not get any error message. My problem is tha once I select the first
combo it did filter the second one, but I can't see the data I just selected.
Let's say I select Colombia, and I see it at this pont. But very soon
Colombia is not there, anymore.

Thanks a lot!!!
"Ray Costanzo [MVP]" wrote:
Show the code you're using to populate the first drop down and the code
you're using to retrieve that value.

Ray at work

"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message
news:99******** *************** ***********@mic rosoft.com...
Hello,

I have a form page in ASP where the first menu/list function as a filter

of
the second menu list. Once I select an item form the first combo I get the
second menu full of options. This is correct. My probem is that the first
combo gets the default value again and I do not see what I did choose.

I do not know if I explained this correctly. Hope someone can understand

me.

Thanks a lot, Lina


Jul 22 '05 #3
Try this:

sSelectedCatego ry = Request.Form("c boPais")

Then get rid of the "selected" text in that dropdown box. (<option
selected>-- Seleccione un País --)

Then, add a second argument to your ComboRS function and use it as such:

Function ComboRS(vector, SelectedValue)
'Pinto el combo
for i= 0 to UBound(vector, 2)
Response.Write "<option value='" & vector(0,i) & " - " &
vector(1,i)& "'"
If vector(0,i) = SelectedValue Then REsponse.Write " selected"
Response.Write ">" & vector(0,i) & " - " & vector(1,i) & vbCrLf
next
End Function
Ray at work

"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message
news:DB******** *************** ***********@mic rosoft.com...
This is the function code tu fill the combos, wher vector is a variable Pais filled with a recorset.

Function ComboRS(vector)
'Pinto el combo
for i= 0 to UBound(vector, 2)
Response.Write "<option value='"& vector(0,i) &" - "& vector(1,i)&"'> "&
vector(0,i) &" - "& vector(1,i) & vbCrLf
next
End Function
%>
Here is the call to the recordset and the way I fill the variable Pais:

strPais = "select IdPais, NmPais from Paises order by NmPais"
Call OpenRS(rsPais,s trPais,ConnAxs)
Pais = rsPais.GetRows
Call CloseRS(rsPais)

If request.form("C boPais") = "" Then
CadenaPais = "57"
Else
Izquierda = instr(1,request .form("CboPais" ),"-")
CadenaPAis = Trim(Left(reque st.form("CboPai s"),Izquierd a - 1))
End If

Here is how I work out the first combo:

'<select name="cboPais" size="1" tabindex="10" onChange="submi t();">
'<option selected>-- Seleccione un País --
'<%Call ComboRS(Pais)%>

This is the code for the recorset of the other combo:

strCentral = "select IdProyecto, NmProyecto from Proyectos Where IdPais
='"& CadenaPais &"' AND Tecnologia = '"& TipoPlanta &"' order by NmProyecto" Call OpenRS(rsCentra l,strCentral,Co nnAxs)
Central = rsCentral.GetRo ws
Call CloseRS(rsCentr al)

I do not get any error message. My problem is tha once I select the first
combo it did filter the second one, but I can't see the data I just selected. Let's say I select Colombia, and I see it at this pont. But very soon
Colombia is not there, anymore.

Thanks a lot!!!
"Ray Costanzo [MVP]" wrote:
Show the code you're using to populate the first drop down and the code
you're using to retrieve that value.

Ray at work

"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message news:99******** *************** ***********@mic rosoft.com...
Hello,

I have a form page in ASP where the first menu/list function as a filter
of
the second menu list. Once I select an item form the first combo I get
the second menu full of options. This is correct. My probem is that the first combo gets the default value again and I do not see what I did choose.

I do not know if I explained this correctly. Hope someone can

understand me.

Thanks a lot, Lina


Jul 22 '05 #4
Thank you Ray

I follow your instruccions, but I allways get the first combo to display the
first item in the table instead the one I selected.

Do you think I am doing something wrong?

You can see what I am saying by going to this link:
http://manager-soft.com/clientes/mic...tml/inicio.htm
and then try the menu "Plantas de Generación" and then "LÃ*neas"

Thanks a lot!

"Ray Costanzo [MVP]" wrote:
Try this:

sSelectedCatego ry = Request.Form("c boPais")

Then get rid of the "selected" text in that dropdown box. (<option
selected>-- Seleccione un PaÃ*s --)

Then, add a second argument to your ComboRS function and use it as such:

Function ComboRS(vector, SelectedValue)
'Pinto el combo
for i= 0 to UBound(vector, 2)
Response.Write "<option value='" & vector(0,i) & " - " &
vector(1,i)& "'"
If vector(0,i) = SelectedValue Then REsponse.Write " selected"
Response.Write ">" & vector(0,i) & " - " & vector(1,i) & vbCrLf
next
End Function
Ray at work

"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message
news:DB******** *************** ***********@mic rosoft.com...
This is the function code tu fill the combos, wher vector is a variable

Pais
filled with a recorset.

Function ComboRS(vector)
'Pinto el combo
for i= 0 to UBound(vector, 2)
Response.Write "<option value='"& vector(0,i) &" - "& vector(1,i)&"'> "&
vector(0,i) &" - "& vector(1,i) & vbCrLf
next
End Function
%>
Here is the call to the recordset and the way I fill the variable Pais:

strPais = "select IdPais, NmPais from Paises order by NmPais"
Call OpenRS(rsPais,s trPais,ConnAxs)
Pais = rsPais.GetRows
Call CloseRS(rsPais)

If request.form("C boPais") = "" Then
CadenaPais = "57"
Else
Izquierda = instr(1,request .form("CboPais" ),"-")
CadenaPAis = Trim(Left(reque st.form("CboPai s"),Izquierd a - 1))
End If

Here is how I work out the first combo:

'<select name="cboPais" size="1" tabindex="10" onChange="submi t();">
'<option selected>-- Seleccione un PaÃ*s --
'<%Call ComboRS(Pais)%>

This is the code for the recorset of the other combo:

strCentral = "select IdProyecto, NmProyecto from Proyectos Where IdPais
='"& CadenaPais &"' AND Tecnologia = '"& TipoPlanta &"' order by

NmProyecto"
Call OpenRS(rsCentra l,strCentral,Co nnAxs)
Central = rsCentral.GetRo ws
Call CloseRS(rsCentr al)

I do not get any error message. My problem is tha once I select the first
combo it did filter the second one, but I can't see the data I just

selected.
Let's say I select Colombia, and I see it at this pont. But very soon
Colombia is not there, anymore.

Thanks a lot!!!
"Ray Costanzo [MVP]" wrote:
Show the code you're using to populate the first drop down and the code
you're using to retrieve that value.

Ray at work

"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message news:99******** *************** ***********@mic rosoft.com...
> Hello,
>
> I have a form page in ASP where the first menu/list function as a filter of
> the second menu list. Once I select an item form the first combo I get the > second menu full of options. This is correct. My probem is that the first > combo gets the default value again and I do not see what I did choose.
>
> I do not know if I explained this correctly. Hope someone can understand me.
>
> Thanks a lot, Lina


Jul 22 '05 #5
Well, the most important thing is to understand what the goal is. The goal
is to take have the server be aware of the value of the selected item when
it redraws the page after the user selects an item from the first dropdown.
Then, as it loops through those items and is writing out all the <option>
html again, what you want to do in your loop is put in a test to see if the
item that is currently being written is the one that the person selected.
If it is, then add " selected" to the HTML output. Here's a simple example:

<%
Dim i
i = Request.Queryst ring("dropdown" )
%>
<html>
<body>
<form method="get">
<select name="dropdown" onchange="this. form.submit();" >
<%
For j = 1 To 10
Response.Write "<option value=""" & j & """"
If CStr(j) = CStr(i) Then Response.Write " selected"
Response.Write ">" & j & "</option>" & vbCrLf
Next
%>
</form>
</body>
</html>

As far as your page, I don't see any dropdowns. I just see javascript
errors and EOF errors.

Ray at home


"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message
news:D7******** *************** ***********@mic rosoft.com...
Thank you Ray

I follow your instruccions, but I allways get the first combo to display
the
first item in the table instead the one I selected.

Do you think I am doing something wrong?

You can see what I am saying by going to this link:
http://manager-soft.com/clientes/mic...tml/inicio.htm
and then try the menu "Plantas de Generación" and then "Líneas"

Thanks a lot!


Jul 22 '05 #6
Yes, something like that is what i am looking for.
The link I gave you is working. Just make sure you select "Plantas de
Generación" and then "LÃ*neas"

So, Ray, what should I do? Should I change my forms from Post to GET?
"Ray Costanzo [MVP]" wrote:
Well, the most important thing is to understand what the goal is. The goal
is to take have the server be aware of the value of the selected item when
it redraws the page after the user selects an item from the first dropdown.
Then, as it loops through those items and is writing out all the <option>
html again, what you want to do in your loop is put in a test to see if the
item that is currently being written is the one that the person selected.
If it is, then add " selected" to the HTML output. Here's a simple example:

<%
Dim i
i = Request.Queryst ring("dropdown" )
%>
<html>
<body>
<form method="get">
<select name="dropdown" onchange="this. form.submit();" >
<%
For j = 1 To 10
Response.Write "<option value=""" & j & """"
If CStr(j) = CStr(i) Then Response.Write " selected"
Response.Write ">" & j & "</option>" & vbCrLf
Next
%>
</form>
</body>
</html>

As far as your page, I don't see any dropdowns. I just see javascript
errors and EOF errors.

Ray at home


"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message
news:D7******** *************** ***********@mic rosoft.com...
Thank you Ray

I follow your instruccions, but I allways get the first combo to display
the
first item in the table instead the one I selected.

Do you think I am doing something wrong?

You can see what I am saying by going to this link:
http://manager-soft.com/clientes/mic...tml/inicio.htm
and then try the menu "Plantas de Generación" and then "LÃ*neas"

Thanks a lot!


Jul 22 '05 #7

"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message
news:2E******** *************** ***********@mic rosoft.com...
Yes, something like that is what i am looking for.
Have you tried applying the logic to your specific code?

The link I gave you is working. Just make sure you select "Plantas de
Generación" and then "Líneas"
CollapseMenu is not defined - Line 62
collapse is not defined - Line 86
collapse is not defined - Line 196
collapse is not defined - Line 53
collapse is not defined - Line 1

That's what I get in Firefox.
So, Ray, what should I do? Should I change my forms from Post to GET?


Not necessarily. If there's reason to post, post. Then just use
Request.Form instead of Request.QuerySt ring

Ray at work
Jul 22 '05 #8
I have tried what you told me but I do not get anything better.
Maybe I do not do what I am supposed to do.

Try the link again and see if it works now.

Thanks a lot!

"Ray Costanzo [MVP]" wrote:

"Lina Manjarres" <Li***********@ discussions.mic rosoft.com> wrote in message
news:2E******** *************** ***********@mic rosoft.com...
Yes, something like that is what i am looking for.


Have you tried applying the logic to your specific code?

The link I gave you is working. Just make sure you select "Plantas de
Generación" and then "LÃ*neas"


CollapseMenu is not defined - Line 62
collapse is not defined - Line 86
collapse is not defined - Line 196
collapse is not defined - Line 53
collapse is not defined - Line 1

That's what I get in Firefox.
So, Ray, what should I do? Should I change my forms from Post to GET?


Not necessarily. If there's reason to post, post. Then just use
Request.Form instead of Request.QuerySt ring

Ray at work

Jul 22 '05 #9

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

Similar topics

2
3277
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help with this problem. I am uncertain about what etiquette calls for, but more on that later. My Objective: I am trying to control the _VMWare Desktop_ application
0
16169
by: vikram.cvk | last post by:
Hello Experts, Im trying to design a CSS vertical drop down menu which should have the following functionality. Home About Us | -->Overview
5
1592
by: michael | last post by:
How may the following script be modified to function with the list structure below it? In short: it is meant to apply a background style to groups of LI's and ULs depeding on the URL filename. <style> ..high {background-color: #99FFCC;} ..low {background-color: #33CC00;} </style>
4
9296
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me if it works, and if it does not, tell me why it does not work. Thanks.
0
4538
by: benfly08 | last post by:
Hi, I used SWT to develop an windows application. In the application there is a dynamic created popup menu. The dynamic part is that i will pass a list of name to be a submenu of one menu item. However, when I code selection event, i cannot access to the list i pass in. Anybody got idea? Below is the code. public static void setUpMenu(final Shell shell, Menu popUpMenu, final String clientId) { myShell = shell; ...
2
2285
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the sub-catagories all appear to the right as they should; however, as soon as you mouse towards any but the TOP sub-catagory, all those sub-catagories still view there. It will work first time quite fine..but if user clicks outsite anywhere in screen then this problem occur.. i think it's css...
3
1566
Stang02GT
by: Stang02GT | last post by:
I have created a menu ( as some of you may have seen in my previous post about adding a third level to a 2 level menu) and now my problem with the menu is that the menu stretches across the whole screen and i would like to position it directly in the center of the screen and fit between a certain area. Is there a way threw the CSS file or maybe something that i can add into the HTML file that i can move the position of the menu and have i...
3
4611
by: jaddi1 | last post by:
Hi, I am trying to make a multi-level drop-down menu similar to what is seen here: http://www.cssplay.co.uk/menus/simple_vertical.html. My problem is that some of the menu will be populated from a database. My menu will be structured as follows: The first setion of the menu is hard-coded (the home and management sections). The rest of the menu will be populated from a database. The top level links (categories) will come from one table...
3
7382
by: tceramesh | last post by:
Hi Friends, I Created one drop down menu by using CSS. It is perfect in Firefox but in IE it creates some problem. in the header section the drop down menu appear,, below that i used one table to put one list menu box.. The problem is, when we mouse over the drop down menu , list box appears in front of the drop down area.. how can i tackle this . The Error occurs only in IE not in Firefox. Here the Code : For...
2
6999
by: RLN | last post by:
I was at this link to add a menu bar to my Access app. http://office.microsoft.com/en-s/access/HP051890341033.aspx I got the menu bar added, but had some more questions about it. In the link above, there was mention of assigning it as the "Global menu" bar, but it does not indicate how to specify a custom menu bar as the global bar. Any idea how to do this?
0
9425
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,...
0
10059
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10005
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,...
0
9871
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 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...
0
8887
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5313
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...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
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

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.