Introduction to asp+ syntax (4)----Introduction to server-side programming of asp+
Author:Eve Cole
Update Time:2009-05-30 19:54:11
Events for operating server controls Each ASP+ server control has its own properties, methods and events. ASP+ developers can now clearly modify and interact with their own pages. In the example below, we use two server controls <asp:button runat=server> and <asp:label runat=server>
and button click event
<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>
The demo address of this program is
http://tutorial.superexpert.com/quickstart/aspplus/samples/webforms/intro/intro6.aspx
This simple example has been briefly demonstrated before in Example 3, but we now use a simple and clear method to demonstrate the functionality of the new version of the server control.