Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTC Listbox

Status
Not open for further replies.

AndyApp

Programmer
Dec 20, 2001
259
GB
All,

How do I get the value from a DTC listbox?

I am currently putting it into a session as it is needed to be called on another page. The syntax I am currently using is as below:

session ("Code") = TwoDigitDropDown.getValue(TwoDigitDropDown.selectedIndex)

All that happens is it is pulling the first value from the listbox, so no matter what you pick, on the next page it just displays the relevant data for that first value.

The listbox is databound to a recordset on the same page.

Anyone help?
 
you do not need to supply a parameter to the getValue() method. Just
session ("Code") = TwoDigitDropDown.getValue()
will do.

If you use query strings, or PageObjectDTC & navigate methods, you will not need to store the value in the session object. i.e.

response.redirect "page2.asp?code="
& TwoDigitDropDown.getValue()


then in page2 you can find the passed code:
dim intCode
intCode = request.queryString("code")
(Content Management)
 
Merlin

It may have something to do with the way i'm calling the value on the second page (maybe I should have mentioned this before) but if I use the session("Code")=TwoDigitDropDown.getValue() it still does the same and I can't get the other one to work.

On the second page I am opening a database (SQL) based on the selected value of the drop down, so it's

"select * FROM databasename WHERE variable = '"+ Session("Code") +"' "

I have also placed a <%=Session(&quot;Code&quot;)%> just to check whether i'm getting anything and I am, just the first value from the drop down!

The straight response.redirect says ; is expected before the &quot;page2.asp and the only way I can get it to recognise the page is to put it all in ( )?? Am I missing something obvious?
 
Sorry, my example was in VB. Add the ( ); and it should be ok. All of this is resolved on the server.

The <% %> is used for server side code - but the 'select.. ' is already in a server side script block (i hope) so this is meaningless.

If you use Design-Time Controls, you may want to look at the PageObject and 'navigate' functions. These effectively simplify the calling of one page by another with parameter passing (if your navigate function has parameters).

Do a search in this forum for more info. (Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top