473,466 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PreviousPage

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
Jun 4 '06 #1
0 1077

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alan Silver | last post by:
Hello, I'm doing a cross page post, and want to pick up information from the previous page. The problem is that the previous page contains a user control that is loaded into a Placeholder at run...
3
by: Kel Good | last post by:
I'm wondering if the PreviousPage property is only populated when a page is cross posted on the same server, or will this work in a web farm situation. Thanks. Kel
1
by: michael.neel | last post by:
Here is the setup: I have an SQL driven sitemap provider - when the user clicks on a database generated link - /Site/DBPages/Article1.aspx - a handler does a Server.Transfer -...
2
by: PeterKellner | last post by:
Is there something extra I need to do to make intellisense work when referencing a page class? Here is my working Page_Load from a aspx page. sourcePage does not get it's members listed with...
1
by: Jim McGivney | last post by:
I have been trying to get the values from a previous page on my target page. I have followed the help article:...
4
by: Bryce | last post by:
I have a search page that submits to a search results page. I have set the search results page to be authenticated, so when the user first tries to search, it redirects them to a login screen. When...
1
by: jeroen.bolle | last post by:
I'm trying to pass variables between pages using the post method. I have access to the the page where I've posted my form, but all the objects are empty... An extract of the code: If Not...
2
by: David C | last post by:
Will the Page.PreviousPage be able to read controls from a non-aspx page, e.g. an html page? Is there a better way to get info. from textboxes/controls? Thanks. David
10
by: rjvrnjn | last post by:
I'm trying to pass a variable value from one page to another. Of all the ways that are available, I like the PreviousPage.FindControl() one as it lets me access the previous page controls and get the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.