values of List Box not access on server side

Last post 03-10-2004 5:26 PM by Andy Smith. 2 replies.

Sort Posts:

  • values of List Box not access on server side

    03-10-2004, 11:47 AM

    lstModel.options[x] = new Option(oSecondary.secondaryValue, oSecondary.secondaryValue );

    Using this statement i insert many values in List Box on client side.
    But when i try to access it in server side in ASP.NET.I found there is 0 values.

    thanks
    KUL


  • Re: values of List Box not access on server side

    03-10-2004, 3:48 PM
    • Contributor
      3,550 point Contributor
    • PDraigh
    • Member since 05-20-2003, 3:37 PM
    • Posts 710
    Because you're adding it to the client side and the options are not passed back to the server on postback. You have to add the options to the drop down for your interface, but then have to add the values to a hidden form field to pass back to the server. Once back to the server, you'll have to do something with them. Save something like this in your hidden field:

    optionvalue1_optiontext1,optionvalue2_optiontext2

    Then server-side, use SPLIT to split it into an array and then parse the values based on the _.
  • Re: values of List Box not access on server side

    03-10-2004, 5:26 PM
    • Participant
      1,910 point Participant
    • Andy Smith
    • Member since 06-10-2002, 4:47 PM
    • Denver, CO
    • Posts 380
    • ASPInsiders
    I've implemented this in my free DynamicListBox control.
Page 1 of 1 (3 items)