<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Controls6_cs.aspx.cs"
Inherits="WebApplication13.Controls6_cs" %>
<script language="C#" runat="server">
protected void EnterBtn_Click( object sender, EventArgs e ) {
if ( Name.Text != "" )
Response.Redirect( "Controls_NavigationTarget_cs.aspx?Name=" +
Server.HtmlEncode( Name.Text ) );
else
Message.Text = "Hey! Please enter your name in the textbox!";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<h3><font face="Verdana">
Performing Page Navigation (Scenario 2)
</font></h3>
This sample demonstrates how to navigate to a new
page from within a <asp:button> click event,
passing a <asp:textbox> value as a querystring
argument (validating first that the a legal textbox
value has been specified).
<hr />
<form runat="server">
<font face="Verdana">
Please enter your name:
<asp:textbox id="Name" runat="server" />
<asp:button text="Enter" Onclick="EnterBtn_Click" _
runat="server" />
<asp:label id="Message" forecolor="red" _
font-bold="true" runat="server" />
</font>
</form>
</body>
</html> |
|
|