PDA

View Full Version : dropDownlist


gajra
09-23-2002, 11:35 AM
IS it possible to Define an editable dropdown list as in done in window forms



AS the dropdownstyle can be set to "dropdown" in a combo box in window forms. Is similar type of style possible in ASP.net dropdownlist???

raf
09-23-2002, 11:43 AM
can you clarify/specify your question ?

what needs to be editable in the dropdown ? what do you mean with 'define' and 'in window forms' ?

gajra
09-23-2002, 12:12 PM
AS the dropdownstyle can be set to "dropdown" in a combo box in window forms. Is similar type of style possible in ASP.net dropdownlist???

raf
09-23-2002, 12:51 PM
i'm (still) not sure i understand you .:confused:
below is the html-code i use for a dropdown (listbox)



<form name="FormName" action="(Empty Reference!)" method="get">
<select name="selectName" size="1">
<option value="one">First
<option value="two">Second
<option value="three">Third
</select>


ASP can write the same html. (The dropdown a user sees on his machine, is straight html. it doesn't matter if it's created by asp or hardcoded by a humane) Every bit of code you can write, asp can write.

To get the same page via asp, the code would look like


<%
response.write("<form name='FormName' action='(Empty Reference!)' method='get'><select name='selectName' size='1'><option value='one'>First<option value='two'>Second<option value='three'>Third</select>")
%>


You can also use ASP to populate the dropdown depending on the content of your database.

example


<body>
<form action="ven_eigenschappen_soort.asp" target="body" id="FORM1" method="post" name="FORM1">
<b>Klik op de gewenste soort.</b>
<p><select id="select1" name="soorten" size="10" onclick="submit();">
<%
dim conGranIT set conGranIT=server.CreateObject("adodb.connection") connectieobject geopend wordt
conGranIT.Open("provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("granit.mdb"))
dim rsSoort set rsSoort = server.CreateObject("adodb.recordset") dim sql sql="select nummer,naam from soorten where categorie=eencategorie"
sql=replace(sql,"eencategorie",request.form("categorie"))
rsSoort.Open sql, conGranIT

do while rsSoort.EOF=false
Response.Write("<option value=" & rsSoort.Fields("nummer")& ">")
Response.Write(server.HTMLEncode(rsSoort.Fields("naam")) & "</option>")
rsSoort.MoveNext
loop



rsSoort.Close
conGranIT.Close

set rsSoort=nothing
set conGranIT = nothing

%>
</select>
</form>
</body>


Maybe I'm just completely on the wrogn track.