PreviousPage

J

Jim McGivney

I am trying to use the PreviousPage feature in asp.net 2.0
On the source (previous page) I have:
protected void Page_Load(object sender, EventArgs e)
{
..... Code to populate ArrMH //ArrMH is an array
MostHits = ArrMH;
}

public String[] MostHits
{
get { return (String[])ViewState["MyArray"]; }
set { ViewState["MyArray"] = value; }
}

protected void Button3_Click(object sender, EventArgs e)
{
Label6.Text = MostHits[0].ToString();
// This works
}

On the target page source code I have:

<%@ Page Language="C#" MasterPageFile="~/CompareMasterPage.master"
AutoEventWireup="true" CodeFile="CompareTest.aspx.cs" Inherits="CompareTest"
Title="Untitled Page" Debug="true"%>

<%@ PreviousPageType VirtualPath="~/CompareResults.aspx" %>

in C# code behind for the target page I have:

protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = PreviousPage.MostHits[0].ToString();
// This generates error: Object reference not set to an instance of an
object.
}

Any help is appreciated,
Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top