Why are there more than 3 items in the dropdownlist ?

Hello, I have code as following. But there are more than three items in the drop downlist. What 's the problem ? (The dropdown list is 1,1,1,1,1,2,3,1,2,3,1,2,3)
<html>
<head>
<title>Ch6-3-5.aspx</title>
<script language="VB" runat="Server">
Sub Page_Load()
Ship.items.add("1")
Ship.items.add("2")
Ship.items.add("3")
End Sub
Sub button_Click(Sender As Object, e As Eventargs)

show.Text = Ship.SelectedItem.Text

End Sub
</script>
</head>
<body>
<p>Web - DropDownList</p><hr>
<form runat="Server">
<p></p>
<asp:DropDownList id="Ship" Width="100px" runat="Server">

</asp:DropDownList>
<asp:button id="Button" Text="send" OnClick="button_Click" runat="Server"/>
</form>
<asp:Label id="show" font-bold="true" runat="Server"/><br>
</body>
</html>Each time the button is clicked another 1,2,3 is added to the DDL. Add this to prevent that from happening:


Sub Page_Load()
If Not Page.IsPostBack Then
Ship.items.add("1")
Ship.items.add("2")
Ship.items.add("3")
End If
End Sub


Why it started with 1,1,1,1 in the first place though, I don't know.
 
Back
Top