Using the drop-down list Association case made by Dongdong under the listcontrol, I had to understand it for two days. Don't laugh at me, hey!

Source: Internet
Author: User
<% @ Page Language = "vb" Debug = "true" %> <% -- note that I have removed ResponseEncoding = "gb2312? I also cannot clearly understand it. It was my troubleshooting in the past two days. I think there is a conflict between his encoding method and left. -- %>
<Html> <Script language = "VB" runat = "server">
'Processing the submit button event
Sub btn_click (sender as object, e as commandeventargs)
Dim s, temp as string, I, j as integer
S = "Welcome:" & txtname. text 'saves the information obtained from the form to the variable S. The following s & = is actually just a connection symbol.
S & = "! The password is: "& txtpassword. text
S & = "selected major:" & zhuanye. selecteditem. text
S & = "your opinion is:" & txtcomment. text
S & = "your school is:" & selyuan. selecteditem. text
S & = "your system is:" & lstxi. selecteditem. text
For I = 0 to chkfond. items. count-1 'loop from 0 to the maximum index-1 of the chkfond set.
If chkfond. items (I). selected then 'Add the selected course item to temp
Temp = temp & chkfond. items (I). text &""
J + = 1
End if
Next
If j> 0 then s & = "the course you selected is:" & temp &". "'Here, pay attention to the subsequent values. s & = indicates that the Chinese value is still stored in the variable S.
Lbl. text = s & "Submit:" & e. commandname & "-" & e. commandargument 'the content displayed on the label
End sub
'Process the "Clear all" button event
Sub tbnr_click (sender as object, e as eventargs)
Dim I as integer
Lbl. text = "" 'clear the content of The lbl label
Txtname. text = "" 'clear name tag content
Txtpassword. text = "" 'clear the password TAG content
Txtcomment. text = "" 'clear the comment label content
Zhuanye. items (0). selected = "true" 'clear Professional Selection
Zhuanye. items (1). selected = "false" 'clear the selection of the selection class control
For I = 0 to chkfond. items. count-1
Chkfond. items (I). selected = false
Next
Chkdirection. checked = false' clear the control class arrangement control content
End sub
'Process double drop-down linkage box and submit button events
Sub selchange (sender as object, e as eventargs)
Dim yuan as string = left (selyuan. selecteditem. text, 2) 'Do not worry, be careful, it's dead. I spent two days here, because only two characters are intercepted. I didn't pay attention to it below, the reason is simple and depressing.
Why is lstxi. items. clear () 'cleared? I don't know much about it. I will write it again when I know it.
Select case yuan
Case "1 ":
Lstxi. items. add ("01-1 series ")
Lstxi. items. add ("01-2 series ")
Lstxi. items. add ("01-3 series ")
Case "6 ":
Lstxi. items. add ("class 022-1 ")
Lstxi. items. add ("class 022-2 ")
Lstxi. items. add ("022-3 ")
Lstxi. items. add ("022-4 ")
Lstxi. items. add ("022-5 ")
Lstxi. items. add ("022-6 ")
Case "18 ":
Lstxi. items. add ("033-1 group ")
Lstxi. items. add ("group 033-2 ")
Lstxi. items. add ("033-3 group ")
Lstxi. items. add ("group 033-4 ")
Lstxi. items. add ("group 033-5 ")
End select
Lstxi. Items (2). selected = "True" 'default selected row
End sub
'Process the chkdirection selection change event and change the chkfond arrangement direction.
Sub chk_checkedchanged (sender as object, e as eventargs)
If chkdirection. checked = true then', if the checked attribute of chkdirection is selected,
Chkfond. repeatdirection = repeatdirection. horizontal then horizontally
Else' otherwise
Chkfond. repeatdirection = repeatdirection. vertical 'is arranged vertically.
End if
End sub
</Script>
</Head>
<Body>
<! -- Text literal display -->
<Asp: Literal ID = "txt" runat = "server">
<Big> <B> <I> Course Selection </I> input and select </B> </big>
</Asp: Literal>
<Form runat = "server">
Enter the name: <br/>
<Asp: TextBox ID = "txtname" Width = "90" runat = "server" value = "guest"/> & nbsp;
Enter the password:
<Asp: TextBox ID = "txtpassword" runat = "server" Columns = "10" value = "123" TextMode = "Password"/> <br/>
Select a major:
<Asp: RadioButtonList ID = "zhuanye" runat = "server" RepeatDirection = "Horizontal">
<Asp: ListItem Selected = "true"> liberal arts </asp: ListItem>
<Asp: ListItem> science </asp: ListItem>
</Asp: RadioButtonList>
Enter your course selection comments <multi-line text box>: <br/>
<Asp: TextBox ID = "txtcomment" runat = "server" Columns = "40" Rows = "5" TextMode = "MultiLine"/> <br/>
Select your school:
<Asp: DropDownList ID = "selyuan" runat = "server" AutoPostBack = "true" OnSelectedIndexChanged = "selchange">
<Asp: ListItem> 1 First Hospital </asp: ListItem>
<Asp: ListItem Selected = "true"> 6 Second Hospital </asp: ListItem>
<Asp: ListItem> 18 third institution </asp: ListItem>
</Asp: DropDownList> & nbsp;
Select your system:
<Asp: ListBox ID = "lstxi" runat = "server">
<Asp: ListItem Selected> association after school selection </asp: ListItem> <% -- pre-assigned Initial Value -- %>
</Asp: ListBox> <br/>
Select your course selection <br/>
<Asp: CheckBoxList ID = "chkfond" runat = "server">
<Asp: ListItem> literature </asp: ListItem>
<Asp: ListItem> music </asp: ListItem>
<Asp: ListItem> politics </asp: ListItem>
</Asp: CheckBoxList> <br/>
<! -- Specify the direction of chkfond -->
<Asp: CheckBox ID = "chkdirection" runat = "server" AutoPostBack = "true" Checked = "false" Text = "horizontal arrangement" OnCheckedChanged = "chk_checkedchanged"/>
<! -- Submit and Clear button -->
<Asp: Button ID = "btn" runat = "server" Text = "Submit" oncommand = "btn_click" CommandName = "time" CommandArgument = "1900-08-20"/>
<Asp: Button ID = "tbnr" Text = "Clear all" runat = "server" OnClick = "tbnr_click"/> <br/>
<Asp: Label ID = "lbl" runat = "server"/>
</Form>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.