Events that operate on Server controls
Each asp + server control has its own attributes, methods, and events. Asp + developers can now clearly modify and interact with their own pages
In the following example, we use two server controls: <asp: button runat = server> and <asp: label runat = server>.
And button click events
| The code is as follows: |
Copy code |
<Html> <Head> <Link rel = "stylesheet" href = "intro.css"> </Head> <Script language = "VB" runat = server> Sub SubmitBtn_Click (Sender As Object, E As EventArgs) Message. Text = "Hi" & Name. Text & ", you selected:" & Category. SelectedItem. Text End Sub </Script> <Body> <Center> <Form action = "intro6.aspx" method = "post" runat = "server"> <Asp: adrotator AdvertisementFile = "ads. xml" BorderColor = "black" BorderWidth = 1 runat = "server"/> <H3> Name: <asp: textbox id = "Name" runat = "server"/> Category: <asp: dropdownlist id = "Category" runat = server> <Asp: listitem> psychology </asp: listitem> <Asp: listitem> business </asp: listitem> <Asp: listitem> popular_comp </asp: listitem> </Asp: dropdownlist> <Asp: button type = submit text = "Lookup" OnClick = "SubmitBtn_Click" runat = "server"/> <P> <Asp: label id = "Message" runat = "server"/> </Form> </Center> </Body> </Html>
|
In this simple example, we have also demonstrated it in example 3, but now we use a simple and clear method to demonstrate the functions of the new version of server controls.