<%@ Page Language="VB" MasterPageFile="~/Default.master" %>
<script runat="server" language="vb">
Protected Sub Page_LoadComplete(ByVal sender As Object, _
ByVal e As System.EventArgs)
Label1.Text = CType(Master.FindControl("Label1"), Label).Text
End Sub
Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
Label2.Text = "<b>Hello " & TextBox1.Text & "!</b>"
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderId="ContentPlaceHolder1" Runat="server">
<b>Your GUID number from the master page is:<br />
<asp:Label ID="Label1" Runat="server" /></b>
<b>Enter your name:</b><br />
<asp:Textbox ID="TextBox1" Runat="server" />
<asp:Button ID="Button1" Runat="server" Text="Submit"
OnClick="Button1_Click" /><br />
<asp:Label ID="Label2" Runat="server" />
</asp:content>
<asp:Content ID="Content2" ContentPlaceHolderId="ContentPlaceHolder2" Runat="server">
<asp:Image ID="Image1" Runat="server" ImageUrl="http://www.java2java.com/style/logo.png" />
</asp:Content>
File: Default.master
<%@ Master Language="VB" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Page.IsPostBack Then
Label1.Text = System.Guid.NewGuid().ToString()
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>My Company Master Page</title>
</head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td colspan="2">
<b>User's GUID:
<asp:Label ID="Label1" Runat="server" /></b>
</td>
</tr>
<tr>
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" Runat="server"/>
</td>
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" Runat="server"/>
</td>
</tr>
<tr>
<td colspan="2">
Copyright 2006 - My Company
</td>
</tr>
</table>
</form>
</body>
</html>
|