DropDownList绑定后数据重复
代码如下
<script runat="server">
Sub Page_Load(Sender As Object,E As EventArgs)
Dim theYear As new ArrayList
Dim theMonth As new ArrayList
Dim i As Integer
For i = 1950 To 1992
theYear.Add(i.ToString())
Next
For i = 1 To 12
theMonth.Add(i.ToString())
Next
DYear.DataSource = theYear
DYear.databind()
DYear.Items.Insert(0,new ListItem("请选择",""))
DMonth.DataSource = theMonth
DMonth.databind()
DMonth.Items.Insert(0,new ListItem("请选择",""))
End Sub
</script>
<tr>
<td>出生年月 <font color="#CC0000">*</font></td>
<td> <asp:DropDownList AppendDataBoundItems="true" ID="DYear" runat="server" />
年
<asp:DropDownList AppendDataBoundItems="true" ID="DMonth" runat="server" />
月</td>
</tr>
问题是显示出来的年份和月份都有重复,请教各位老师!谢谢!