Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Dynamic drop down list problem

Reply
Thread Tools

Dynamic drop down list problem

 
 
Jochen
Guest
Posts: n/a
 
      10-12-2004
Hello,

I have an asp application which I made "Multilanguage". I made an asp file
for every language with all the strings to be used stored like this:

Langstring1 = "French"
Langstring20 = "VTest"

In the beginning of an asp file I determine which language file to include.
In my database there are only numbers. I can now display the right text in
the right language using respons.write: Response.write(Langstring20)

Now I want to use a dropdown box displaying a text as selected based on a
relation between the number in my database and my language files. When I
have number 20 in a database, the value of the option should be 20 and the
text displayed should be 'VTest' for this is Langstring20. Problem is that
the option value seems to be correct with what I do, but the text displayed
in the box is not correct. How can I solve this?

What I did was the following:

------------------------------------------------
Langstring = "Langstring"

<select name="Testbox">
<option value="<%=RSItems("Testfile")%>"
selected><%=response.write(Langstring&RSItems("Tes tfile"))%>
<option value="20">VTest
<option value="21">TTest
<option value="22">FTest
</select>
----------------------------------------

What did I do wrong?


 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      10-12-2004
Looks like you try to use "dynamic" variables ???

Response.Write(langstring&rsitems("TestFile")) will write what is in the
langstring variable followed but what is in the rstitems("testfile"). Is
this what you experience ?

Patrice

--

"Jochen" <(E-Mail Removed)> a écrit dans le message de
news:zuUad.276785$(E-Mail Removed)-ops.be...
> Hello,
>
> I have an asp application which I made "Multilanguage". I made an asp file
> for every language with all the strings to be used stored like this:
>
> Langstring1 = "French"
> Langstring20 = "VTest"
>
> In the beginning of an asp file I determine which language file to

include.
> In my database there are only numbers. I can now display the right text

in
> the right language using respons.write: Response.write(Langstring20)
>
> Now I want to use a dropdown box displaying a text as selected based on a
> relation between the number in my database and my language files. When I
> have number 20 in a database, the value of the option should be 20 and the
> text displayed should be 'VTest' for this is Langstring20. Problem is that
> the option value seems to be correct with what I do, but the text

displayed
> in the box is not correct. How can I solve this?
>
> What I did was the following:
>
> ------------------------------------------------
> Langstring = "Langstring"
>
> <select name="Testbox">
> <option value="<%=RSItems("Testfile")%>"
> selected><%=response.write(Langstring&RSItems("Tes tfile"))%>
> <option value="20">VTest
> <option value="21">TTest
> <option value="22">FTest
> </select>
> ----------------------------------------
>
> What did I do wrong?
>
>



 
Reply With Quote
 
 
 
 
Jochen
Guest
Posts: n/a
 
      10-12-2004
Indeed, that's what I experience

"Patrice" <(E-Mail Removed)> wrote in message
news:Of8M%(E-Mail Removed)...
> Looks like you try to use "dynamic" variables ???
>
> Response.Write(langstring&rsitems("TestFile")) will write what is in the
> langstring variable followed but what is in the rstitems("testfile"). Is
> this what you experience ?
>
> Patrice
>
> --
>
> "Jochen" <(E-Mail Removed)> a écrit dans le message de
> news:zuUad.276785$(E-Mail Removed)-ops.be...
>> Hello,
>>
>> I have an asp application which I made "Multilanguage". I made an asp
>> file
>> for every language with all the strings to be used stored like this:
>>
>> Langstring1 = "French"
>> Langstring20 = "VTest"
>>
>> In the beginning of an asp file I determine which language file to

> include.
>> In my database there are only numbers. I can now display the right text

> in
>> the right language using respons.write: Response.write(Langstring20)
>>
>> Now I want to use a dropdown box displaying a text as selected based on a
>> relation between the number in my database and my language files. When I
>> have number 20 in a database, the value of the option should be 20 and
>> the
>> text displayed should be 'VTest' for this is Langstring20. Problem is
>> that
>> the option value seems to be correct with what I do, but the text

> displayed
>> in the box is not correct. How can I solve this?
>>
>> What I did was the following:
>>
>> ------------------------------------------------
>> Langstring = "Langstring"
>>
>> <select name="Testbox">
>> <option value="<%=RSItems("Testfile")%>"
>> selected><%=response.write(Langstring&RSItems("Tes tfile"))%>
>> <option value="20">VTest
>> <option value="21">TTest
>> <option value="22">FTest
>> </select>
>> ----------------------------------------
>>
>> What did I do wrong?
>>
>>

>
>



 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      10-13-2004
Ok this is exactly what the code means. You could use "Eval" to evaluate the
expression.
THAT SAID, I would avoid using "dynamically named" variables which is bad
IMO.

If you still want something similar you could use an array instead with one
dimension for the language and the other for the string id.

See :
http://msdn.microsoft.com/library/de...sVariables.asp
at the bottom of the page.

Patrice

--

"Jochen" <(E-Mail Removed)> a écrit dans le message de
news:HVVad.276874$(E-Mail Removed)-ops.be...
> Indeed, that's what I experience
>
> "Patrice" <(E-Mail Removed)> wrote in message
> news:Of8M%(E-Mail Removed)...
> > Looks like you try to use "dynamic" variables ???
> >
> > Response.Write(langstring&rsitems("TestFile")) will write what is in the
> > langstring variable followed but what is in the rstitems("testfile"). Is
> > this what you experience ?
> >
> > Patrice
> >
> > --
> >
> > "Jochen" <(E-Mail Removed)> a écrit dans le message de
> > news:zuUad.276785$(E-Mail Removed)-ops.be...
> >> Hello,
> >>
> >> I have an asp application which I made "Multilanguage". I made an asp
> >> file
> >> for every language with all the strings to be used stored like this:
> >>
> >> Langstring1 = "French"
> >> Langstring20 = "VTest"
> >>
> >> In the beginning of an asp file I determine which language file to

> > include.
> >> In my database there are only numbers. I can now display the right

text
> > in
> >> the right language using respons.write: Response.write(Langstring20)
> >>
> >> Now I want to use a dropdown box displaying a text as selected based on

a
> >> relation between the number in my database and my language files. When

I
> >> have number 20 in a database, the value of the option should be 20 and
> >> the
> >> text displayed should be 'VTest' for this is Langstring20. Problem is
> >> that
> >> the option value seems to be correct with what I do, but the text

> > displayed
> >> in the box is not correct. How can I solve this?
> >>
> >> What I did was the following:
> >>
> >> ------------------------------------------------
> >> Langstring = "Langstring"
> >>
> >> <select name="Testbox">
> >> <option value="<%=RSItems("Testfile")%>"
> >> selected><%=response.write(Langstring&RSItems("Tes tfile"))%>
> >> <option value="20">VTest
> >> <option value="21">TTest
> >> <option value="22">FTest
> >> </select>
> >> ----------------------------------------
> >>
> >> What did I do wrong?
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Multiple select drop down poplulating sub drop down scott@dettcom.com Javascript 3 11-09-2006 07:50 PM
Auto Drop down a Drop Down List xxbmichae1@supergambler.com Javascript 5 11-23-2005 01:35 AM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM



Advertisments