我有一个PHP代码
-
---------
<div id="product1">
<select name="product" class=":required" onchange="change1(this.value)">
<option value="" selected="selected">Select Product</option>
<option value="10">
Almond </option>
<option value="18">
Capsicum </option>
<option value="3">
Cashew </option>
<option value="1">
Cocoa </option>
<option value="2">
Coffee </option>
<option value="4">
Cotton </option>
<option value="16">
Garlic </option>
<option value="13">
Grains </option>
<option value="22">
Groundnut </option>
<option value="17">
Onion </option>
<option value="19">
Parsley </option>
<option value="9">
Peanut </option>
<option value="7">
Pepper </option>
<option value="11">
Pulses </option>
<option value="5">
Rice </option>
<option value="6">
Sesame </option>
<option value="8">
Spice </option>
<option value="14">
Sugar </option>
<option value="15">
Tomato </option>
<option value="12">
Wool </option>
<option value="23">
_ Other _ </option>
</select>
</div>
我想在下拉框中填充所有这些项目。怎么做。我使用asp.net和vb.net作为代码。页面加载后,项目必须填充在下拉框中。
我有其他PHP代码
<tr>
<td align="right">Select Region:</td>
<td align="left" class="red"><select onchange="xajax_SelectCountry(this.value);" name="region" class=":required" id="region">
<option value="" selected="selected">Select Region</option>
<option value="Asia" >
Asia </option>
<option value="Australia and Oceania" >
Australia and Oceania </option>
<option value="Central Africa" >
Central Africa </option>
<option value="East Africa" >
East Africa </option>
<option value="Europe" >
Europe </option>
<option value="North Africa" >
North Africa </option>
<option value="North America" >
North America </option>
<option value="South America" >
South America </option>
<option value="Southern Africa" >
Southern Africa </option>
<option value="West Africa" >
West Africa </option>
</select></td>
</tr>
<tr>
我需要在下拉框中。
答案 0 :(得分:3)
试试这个:
<asp:DropDownList runat="server" ID="ddl1">
<asp:ListItem Value="Select Product" Selected="True"></asp:ListItem>
<asp:ListItem Value="10" Text="Almond"> </asp:ListItem>
<asp:ListItem Value="18" Text="Capsicum"> </asp:ListItem>
<asp:ListItem Value="3" Text="Cashew"> </asp:ListItem>
<asp:ListItem Value="1" Text="Cocoa"> </asp:ListItem>
<asp:ListItem Value="2" Text="Coffee"> </asp:ListItem>
<asp:ListItem Value="4" Text="Cotton"> </asp:ListItem>
<asp:ListItem Value="16" Text="Garlic"> </asp:ListItem>
<asp:ListItem Value="13" Text="Grains"> </asp:ListItem>
<asp:ListItem Value="22" Text="Groundnut"> </asp:ListItem>
<asp:ListItem Value="17" Text="Onion"> </asp:ListItem>
<asp:ListItem Value="19" Text="Parsley"> </asp:ListItem>
<asp:ListItem Value="9" Text="Peanut"> </asp:ListItem>
<asp:ListItem Value="7" Text="Pepper"> </asp:ListItem>
<asp:ListItem Value="11" Text="Pulses"> </asp:ListItem>
<asp:ListItem Value="5" Text="Rice"> </asp:ListItem>
<asp:ListItem Value="6" Text="Sesame"> </asp:ListItem>
<asp:ListItem Value="8" Text="Spice"> </asp:ListItem>
<asp:ListItem Value="14" Text="Sugar"></asp:ListItem>
<asp:ListItem Value="15" Text="Tomato"> </asp:ListItem>
<asp:ListItem Value="12" Text="Wool"> </asp:ListItem>
<asp:ListItem Value="23" Text="_ Other _"></asp:ListItem>
</asp:DropDownList>