关于visual studio的DropDownList问题
在网页仲有一个用户注册表,其中出生日期旁有三个DropDownList控件,当我选择里年月日之后.发现月和日的列表里增加了一些内容.如:月123451<--这里重复了.怎...
在网页仲有一个用户注册表,其中出生日期旁有三个DropDownList控件,当我选择里年月日之后.发现月和日的列表里增加了一些内容.
如:
月
1
2
3
4
5
1<--这里重复了.怎么清除
2
3
4
5
代码如下:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim i As Integer
Dim li As ListItem
For i = 1 To 12
li = New ListItem(i & "月")
DDLmonth.Items.Add(li)
Next
Dim k, s, temp As Integer
temp = DDLmonth.SelectedIndex + 1
Select Case temp
Case 1, 3, 5, 7, 8, 10, 12
s = 31
Case 4, 6, 9, 11
s = 30
Case 2
s = 28
End Select
For k = 1 To s
li = New ListItem(k & "日")
DDLday.Items.Add(li)
Next
For j = 1980 To 1990
li = New ListItem(j & "年")
DDLyear.Items.Add(li)
Next
End Sub 展开
如:
月
1
2
3
4
5
1<--这里重复了.怎么清除
2
3
4
5
代码如下:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim i As Integer
Dim li As ListItem
For i = 1 To 12
li = New ListItem(i & "月")
DDLmonth.Items.Add(li)
Next
Dim k, s, temp As Integer
temp = DDLmonth.SelectedIndex + 1
Select Case temp
Case 1, 3, 5, 7, 8, 10, 12
s = 31
Case 4, 6, 9, 11
s = 30
Case 2
s = 28
End Select
For k = 1 To s
li = New ListItem(k & "日")
DDLday.Items.Add(li)
Next
For j = 1980 To 1990
li = New ListItem(j & "年")
DDLyear.Items.Add(li)
Next
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询