Jump to content

HTML: loading a variable into a list box


Recommended Posts

For a static list box, the initial value can be readily set by using selected="selected" in .

But I want to save 0ption value that the user selects and then make this the selected value the next time he goes to the server site.

I can readily read and write from files on the server using ASP, but I do not how to get the retrieved value into the list menu as a default value.

Can I avoid Recordsets, Dynamic List Boxes etc?

Thanks for you help.


Link to comment
Share on other sites

Can I avoid Recordsets, Dynamic List Boxes etc?


Is this classic ASP you are talking about or ASP.net?


If classic ASP, you can either: just manually set the default value in the HTML (may not be the best approach for nerd reasons .. but it works) or you can use a simple condition when populating the list box to filter for whatever default value you are looking for.


... It all depends on what the criteria is for the default selection.


For ASP.net, I think you can just set that in the list box control. It has been many years since I use ASP.net, so my memory is weak on that one.



Link to comment
Share on other sites


Thanks for your quick reply... I am using the ASP examples from w3Schools. My server does not run .ASPX, so I guess I cannot use ASP.NET.

I am not sure what you mean by populating the list box...

There seems to be no variable structure in basic HTML code to do this.

However, I guess I could use ASP to write HTML code for all whole list.

Is this what you had in mind?

Sorry I am not more familiar with basic web design


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...