-
Combobox in ASP / HTML ?
Hi everyone !
1) I'm currently developping an ASP application using ADO. I want to know if it is possible to transfer the content of a particular field of all records in a table to a listbox ? If so, how ? I tried many things, but keep getting errors !
2) Is it possbile to transfer an array from the server to the client ?
If so, how ?
3) Is there anything like a combobox in HTML i could use (like in VB) ?
I'm rather new to ASP and HTML, but I guess you already figured it out ! :P
Thanks in advance !
-
HTML
I know that there is a combobox available in HTML
When you make a Form (I think you know how)
You can add a combo by using:
<SELECT name="test">
<OPTION>OptionA</OPTION>
<OPTION>OptionB</OPTION>
<OPTION>OptionC</OPTION>
<OPTION>OptionD</OPTION>
</SELECT>
But how to import options from a table I don't know.
I hope I helped...
Grtz,
Bloged
-
-
1) Goto http://www.learnasp.com. They have a couple articles on this.
2) Do you mean server as in from an ASP page to VbScript or Javascript on the client?
If so, No.
3) See above replies.
-
I'm pretty new to ASP too, but I know you can mix-and-match tags, so...
Code:
' blah blah, open database connection, get stuff out, open HTML and BODY tags in page, when you eventually get to the box, its something like this:
'while within HTML tag (ASP tag closed)
<SELECT name="test">
<%
for loop = 0 to wherever you want
%>
<option><%=loop%><option>
<%
next
%>
</select>
I know it looks a bit clumsy, I'm not able to test it, but I hope you get the gist of what I'm trying to say.
BTW the bold bit <%=loop%> means exactly the same as
<%
response.write loop
%>
:)
-
You can sort of transfer an array between client and server:
You must use Response.Write to create the client side array code and populate it in the same manner.
You can not change it on the client and see those changes on the server unless you post the array back to the server in an HTML form tag or some other persistence method.
I use that all the time to create dynamic list boxes that change their content based on the selection in another list box.
-
Thanks for all the info guys !
Especially Behemoth, I modified your code to suit my needs, thanks dude !
I finally managed to get things up, Sort'of;
I Used a textbox refreshing on every <Select> which refreshes the textbox... well kinda dependent on each other ! Does the trick ! =)
:cool: