<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Controls5_cs.aspx.cs"
Inherits="WebApplication11.Controls5_cs" %>
<script language="C#" runat="server">
protected void Page_Load( object sender, EventArgs e ) {
Random random = new Random( DateTime.Now.Millisecond );
int randomNum = random.Next( 3 );
switch( randomNum ) {
case 0:
Name.Text = "Scott";
break;
case 1:
Name.Text = "Fred";
break;
case 2:
Name.Text = "Adam";
break;
}
AnchorLink.NavigateUrl = "Controls_NavigationTarget_cs.aspx?name=" +
Server.HtmlEncode( Name.Text );
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form runat=server>
<h3><font face="Verdana">
Performing Page Navigation (Scenario 1)
</font></h3>
This sample demonstrates how to generate an HTML
Anchor tag that will cause the client to navigate
to a new page when he/she clicks it within the browser.
<hr />
<asp:hyperlink id="AnchorLink" font-size="24" runat="server">
Hi <asp:label id="Name" runat="server" /> please click this link!
</asp:hyperlink>
</form>
</body>
</html> |
|
|