Combo Box Question

Results 1 to 4 of 4

Thread: Combo Box Question

  1. #1
    Kris Bailey Guest

    Default Combo Box Question

    How can I assign the value to a combo box from a posting page?<BR><BR>See I have this form which the user selects his name and then fills out some information. He then hits submit, which then runs a asp page that adds the information to the database. You then hit another button that takes you back to the starting page and from here I would like his name to be still selected in the combo box. This may be simple but I could really use some input on this thanks!

  2. #2
    Steve M Guest

    Default RE: Combo Box Question

    If you are building the combobox in asp, you could output a SELECTED attribute for the &#060;OPTION&#062; tag of the interesting name. You would have to store this name somewhere, maybe in a hidden tag, so it would be available.<BR>&#060;%<BR>If lsName = lsCurrentName Then<BR> Response.Write("&#060;OPTION VALUE=&#039" & lsName & "&#039 SELECTED&#062;")<BR>Else<BR> Response.Write("&#060;OPTION VALUE=&#039" & lsName & "&#039&#062;")<BR>End If<BR>%&#062;<BR>Hope it helps.

  3. #3
    Join Date
    Dec 1969

    Default RE: Combo Box Question

    What I do in listboxes (similar I think to what you mean)<BR><BR>test to see if the user has entered a value(will be true if he is returning to the form - false if opening for 1st time)<BR><BR>Then add an option for the user to the list - means you get 2 of the selected variable - which in my case does no harm, is usually not noticed, and saves iterating thru the list.<BR><BR>if len(Title) &#062; 0 then<BR> selTitleOptions = "&#060;option selected value=&#039" & Title"&#039&#062;" &Title<BR>end if<BR><BR>selTitleOptions = selTitleOptions + whatever it usually is...<BR><BR>then use &#060;%=selTitlOptions%&#062; in your select later on.<BR><BR>There seem to be lots of ways to do this, but I couldn&#039t think of any other way that didn&#039t involve iterating thru the list and inserting selected. Depends if the doubleup matters in your app I guess.<BR><BR>Look forward to the rest of your replies with interest.

  4. #4
    Kris Bailey Guest

    Default Thanks!

    Thanks Jennifer and Steve! I got it now!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts