Dynamic drop down list problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jochen

    Dynamic drop down list problem

    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="<%=RSIte ms("Testfile")% >"
    selected><%=res ponse.write(Lan gstring&RSItems ("Testfile") )%>
    <option value="20">VTes t
    <option value="21">TTes t
    <option value="22">FTes t
    </select>
    ----------------------------------------

    What did I do wrong?


  • Patrice

    #2
    Re: Dynamic drop down list problem

    Looks like you try to use "dynamic" variables ???

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

    Patrice

    --

    "Jochen" <jochen.scheire @pandora.be> a écrit dans le message de
    news:zuUad.2767 85$Wq.14260252@ phobos.telenet-ops.be...[color=blue]
    > 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[/color]
    include.[color=blue]
    > In my database there are only numbers. I can now display the right text[/color]
    in[color=blue]
    > 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[/color]
    displayed[color=blue]
    > in the box is not correct. How can I solve this?
    >
    > What I did was the following:
    >
    > ------------------------------------------------
    > Langstring = "Langstring "
    >
    > <select name="Testbox">
    > <option value="<%=RSIte ms("Testfile")% >"
    > selected><%=res ponse.write(Lan gstring&RSItems ("Testfile") )%>
    > <option value="20">VTes t
    > <option value="21">TTes t
    > <option value="22">FTes t
    > </select>
    > ----------------------------------------
    >
    > What did I do wrong?
    >
    >[/color]


    Comment

    • Jochen

      #3
      Re: Dynamic drop down list problem

      Indeed, that's what I experience

      "Patrice" <nobody@nowhere .com> wrote in message
      news:Of8M%23PIs EHA.3464@TK2MSF TNGP14.phx.gbl. ..[color=blue]
      > Looks like you try to use "dynamic" variables ???
      >
      > Response.Write( langstring&rsit ems("TestFile") ) will write what is in the
      > langstring variable followed but what is in the rstitems("testf ile"). Is
      > this what you experience ?
      >
      > Patrice
      >
      > --
      >
      > "Jochen" <jochen.scheire @pandora.be> a écrit dans le message de
      > news:zuUad.2767 85$Wq.14260252@ phobos.telenet-ops.be...[color=green]
      >> 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[/color]
      > include.[color=green]
      >> In my database there are only numbers. I can now display the right text[/color]
      > in[color=green]
      >> 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[/color]
      > displayed[color=green]
      >> in the box is not correct. How can I solve this?
      >>
      >> What I did was the following:
      >>
      >> ------------------------------------------------
      >> Langstring = "Langstring "
      >>
      >> <select name="Testbox">
      >> <option value="<%=RSIte ms("Testfile")% >"
      >> selected><%=res ponse.write(Lan gstring&RSItems ("Testfile") )%>
      >> <option value="20">VTes t
      >> <option value="21">TTes t
      >> <option value="22">FTes t
      >> </select>
      >> ----------------------------------------
      >>
      >> What did I do wrong?
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • Patrice

        #4
        Re: Dynamic drop down list problem

        Ok this is exactly what the code means. You could use "Eval" to evaluate the
        expression.
        THAT SAID, I would avoid using "dynamicall y 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 :

        at the bottom of the page.

        Patrice

        --

        "Jochen" <jochen.scheire @pandora.be> a écrit dans le message de
        news:HVVad.2768 74$3e6.14202949 @phobos.telenet-ops.be...[color=blue]
        > Indeed, that's what I experience
        >
        > "Patrice" <nobody@nowhere .com> wrote in message
        > news:Of8M%23PIs EHA.3464@TK2MSF TNGP14.phx.gbl. ..[color=green]
        > > Looks like you try to use "dynamic" variables ???
        > >
        > > Response.Write( langstring&rsit ems("TestFile") ) will write what is in the
        > > langstring variable followed but what is in the rstitems("testf ile"). Is
        > > this what you experience ?
        > >
        > > Patrice
        > >
        > > --
        > >
        > > "Jochen" <jochen.scheire @pandora.be> a écrit dans le message de
        > > news:zuUad.2767 85$Wq.14260252@ phobos.telenet-ops.be...[color=darkred]
        > >> 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[/color]
        > > include.[color=darkred]
        > >> In my database there are only numbers. I can now display the right[/color][/color][/color]
        text[color=blue][color=green]
        > > in[color=darkred]
        > >> the right language using respons.write: Response.write( Langstring20)
        > >>
        > >> Now I want to use a dropdown box displaying a text as selected based on[/color][/color][/color]
        a[color=blue][color=green][color=darkred]
        > >> relation between the number in my database and my language files. When[/color][/color][/color]
        I[color=blue][color=green][color=darkred]
        > >> 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[/color]
        > > displayed[color=darkred]
        > >> in the box is not correct. How can I solve this?
        > >>
        > >> What I did was the following:
        > >>
        > >> ------------------------------------------------
        > >> Langstring = "Langstring "
        > >>
        > >> <select name="Testbox">
        > >> <option value="<%=RSIte ms("Testfile")% >"
        > >> selected><%=res ponse.write(Lan gstring&RSItems ("Testfile") )%>
        > >> <option value="20">VTes t
        > >> <option value="21">TTes t
        > >> <option value="22">FTes t
        > >> </select>
        > >> ----------------------------------------
        > >>
        > >> What did I do wrong?
        > >>
        > >>[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...