vb.net DropDownList绑定后数据重复

代码如下<scriptrunat="server">SubPage_Load(SenderAsObject,EAsEventArgs)DimtheYearAsnewArr... 代码如下
<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>

问题是显示出来的年份和月份都有重复,请教各位老师!谢谢!
我爱领袖:
我测试了一下,不行啊
错误提示:
编译器错误信息: BC30451: 未声明名称“flase”。

改成“false”也不行。
展开
 我来答
我爱领袖
2008-10-22 · 超过66用户采纳过TA的回答
知道小有建树答主
回答量:190
采纳率:0%
帮助的人:0
展开全部
Sub Page_Load(Sender As Object,E As EventArgs)
if IspostBack=flase then

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 if
End Sub

添加IspostBack=false

============================
flase写错了,是False
ye770
2008-10-20 · TA获得超过191个赞
知道小有建树答主
回答量:597
采纳率:0%
帮助的人:279万
展开全部
IspostBack
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式