<%@Page Language="VB" Debug="True" %>
<%@Reference Page="executepage.aspx" %>

<script runat="server">

Sub Page_Load()
  If Not Page.IsPostback Then

    Try
      ' get a reference to the previous page
      Dim oRefPage As ExecutePage = CType(Context.Handler, _
                                            ExecutePage)
      ' display the property values from the previous page
      lblProperties.Text = "TextValue = " _
                    & oRefPage.TextValue & "<br />" _
                    & "ListIndex.ToString() = " _
                    & oRefPage.ListIndex.ToString() & "<br />" _
                    & "DropList.ToString() = " _
                    & oRefPage.DropList.ToString() & "<br />" _
                    & "DropList.SelectedValue = " _
                    & oRefPage.DropList.SelectedValue
    Catch
      lblProperties.Text = "ERROR: Cannot reference previous page"
    End Try

    ' display the values in the Request collections
    lblRequest.Text &= "* QueryString collection:<br />"
    For Each oValue As String In Request.QueryString
      lblRequest.Text &= "  " & oValue & " = " _
                      & Request.QueryString(oValue) & "<br />"
    Next
    lblRequest.Text &= "* Form collection:<br />"
    For Each oValue As String In Request.Form
      lblRequest.Text &= "  " & oValue & " = " _
                      & Request.Form(oValue) & "<br />"
    Next

  End If
End Sub

</script>

<!------------------------------------------------------------->

<html>
<head>
<!-- #include file="../global/style.inc" -->
<title>Accessing Page Values via a Reference</title>
</head>
<body>
<span class="heading">Accessing Page Values via a Reference</span><hr />

<b>Values of properties exposed by previous page</b>:<br />
<asp:Label id="lblProperties" runat="server" /><p />
<b>Values in the Request collections</b>:<br />
<asp:Label id="lblRequest" runat="server" />

<hr /><span class="cite">
[<a href="../global/viewsource.aspx?compsrc=catchreference.htm" target="_blank">view source</a>]  
<!-- #include file="../global/footer.inc" -->
</body>
</html>