Hashtable output repeats in asp.net -
I have tried the following code to bind the hashtable to the list box.
.aspx: .aspx.vb When executed, give me the following output Found in: When I used single, why did it happen twice Is loop in my code? And what can I do to solve my problem? something like that? Close
& lt;% @ page language = "VB" AutoEventWireUp = "False" Codefile = "hashtable.exx.web" inherits = "hashtable" & gt%; & Lt ;; DOCTYPE HTML PUBLIC "- // W3C // DTT XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Head id = "head1" runat = "server" & gt; & Lt; Title & gt; Untitled Page & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "form1" runat = "server" & gt; & Lt; Div & gt; & Lt; ASP: Button ID = "Button 1" Runat = "Server" OnClick = "Button 1_Click" Text = "Button" /> & Lt; Br / & gt; & Lt; ASP: List Box ID = "ListBloc 1" Run = "Server" & gt; & Lt; / Asp: List box & gt; & Lt; Br / & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;
# Area "namespace" import system Data import system IoO Import System.net.mail # Field Area Partial Class Hashtable Inherits System. Web. UI Page Protected Sub Button 1_Click (By-object as Object, Bye System.EventArg) Button 1. Click as ht.Items.Add ("1", "Sunday") as HT ("2", "Monday") ht.Items.Add ("3", "Tuesday") HT. Ht.Items.Add ("4", "Wednesday") ht.Items.Add ("5", "Thursday") ht.Items.Add ("6", "Friday") ht.Items.Add ("7", "Saturday" ) Ht.Items ListBox1.Items.Add (item.key) for each item ListBox1.Items.Add (item.value) Next End Sub End Class
1 Sunday 2 Monday 3 Tuesday 4 Wednesday 5 Thursday 6 Friday 7 Saturday 1 Sunday 2 Monday 3 Tuesday 4 Wednesday 5 Thursday 6 Friday 7 Saturday < / Code>
box_id, box_refid, box_value, effdate, box_percent union, all selected box_id, box_refid, null, null, null box_percent where the blank is not empty
Comments
Post a Comment