Dynamic drop down list problem

Discussion in 'ASP General' started by Jochen, Oct 12, 2004.

  1. Jochen

    Jochen Guest

    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("Testfile"))%>
    <option value="20">VTest
    <option value="21">TTest
    <option value="22">FTest
    </select>
    ----------------------------------------

    What did I do wrong?
    Jochen, Oct 12, 2004
    #1
    1. Advertising

  2. Jochen

    Patrice Guest

    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" <> a écrit dans le message de
    news:zuUad.276785$-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("Testfile"))%>
    > <option value="20">VTest
    > <option value="21">TTest
    > <option value="22">FTest
    > </select>
    > ----------------------------------------
    >
    > What did I do wrong?
    >
    >
    Patrice, Oct 12, 2004
    #2
    1. Advertising

  3. Jochen

    Jochen Guest

    Indeed, that's what I experience

    "Patrice" <> wrote in message
    news:Of8M%...
    > 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" <> a écrit dans le message de
    > news:zuUad.276785$-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("Testfile"))%>
    >> <option value="20">VTest
    >> <option value="21">TTest
    >> <option value="22">FTest
    >> </select>
    >> ----------------------------------------
    >>
    >> What did I do wrong?
    >>
    >>

    >
    >
    Jochen, Oct 12, 2004
    #3
  4. Jochen

    Patrice Guest

    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/default.asp?url=/library/en-us/script56/html/vbsVariables.asp
    at the bottom of the page.

    Patrice

    --

    "Jochen" <> a écrit dans le message de
    news:HVVad.276874$-ops.be...
    > Indeed, that's what I experience
    >
    > "Patrice" <> wrote in message
    > news:Of8M%...
    > > 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" <> a écrit dans le message de
    > > news:zuUad.276785$-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("Testfile"))%>
    > >> <option value="20">VTest
    > >> <option value="21">TTest
    > >> <option value="22">FTest
    > >> </select>
    > >> ----------------------------------------
    > >>
    > >> What did I do wrong?
    > >>
    > >>

    > >
    > >

    >
    >
    Patrice, Oct 13, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SirPoonga
    Replies:
    2
    Views:
    751
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,008
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    468
    msimmons
    Jul 16, 2009
  4. Replies:
    5
    Views:
    266
  5. Replies:
    3
    Views:
    283
Loading...

Share This Page