操作服務器控件的事件
每一個ASP+的服務器控件都有自己的屬性,方法和事件。ASP+的開發者現在可以清楚的修改和交互自己的頁面
下面的這個例子,我們用到了兩個服務器控件<asp:button runat=server> ,<ASP:label runat=server>
和button 的 click 事件
<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>