<script language="C#" runat="server">
protected void enterBtn_Click( object sender, EventArgs e ) {
message.Text = "Hi " + name.Text + ", welcome to ASP.NET!";
}
</script>
<html>
<body>
<h2>Handling Control Action Events</h2>
This sample demonstrates how to access a <asp:textbox>
server control within the "Click" event of a <asp:button>,
and use its content to modify the text of a <asp:label>.
<hr />
<form runat="server">
Please enter your name: <asp:textbox id="name" runat="server" />
<asp:button text="Enter" Onclick="enterBtn_Click" runat="server" />
<asp:label id="message" runat="server" />
</form>
</body>
</html>
|