server transfer and previous page refference issue

  • Thread starter Yankee Imperialist Dog!
  • Start date
Y

Yankee Imperialist Dog!

i have two pages with a shared master page
i'm using server transfer to get to the other page.
page1, page2;
on load in page 2
i have:
if (!IsPostBack)
{
var ppg = PreviousPage as Page1;
}
the designer understands that Page1 exists
but when i compile i get an error: CS0246: The type or namespace name
'Page1' could not be found (are you missing a using directive or an assembly
reference?)

if i use only
var ppg = PreviousPage;
and debug on that line, or the next. It is clearly set to Page1 and has all
the values associated with it.

note that i'm getting a compile error not a runtime error.

What am i doing wrong or what do i need to include????

Thanks
KES
 
Y

Yankee Imperialist Dog!

I have no idea why this happened, but i killed the page and started over.
It is exactly the same, ans far as i can tell, but now it works
 
Y

Yankee Imperialist Dog!

BTW: the best way i've found so far to handle complex business objects on a
server transfer or a corsspage postback is to just create a property of
type "complexbusinessobject"
public SSOrder CurrentSSOrder { get; set;}

on button click if all is valid
CurrentSSOrder = oqcss;
Server.Transfer("OrderComplete.aspx", true);

...........
just do this on the second page
if(!IsPostBack)
{
var oqcss = ((OE01) PreviousPage).CurrentSSOrder;
Label1.Text = oqcss.Hed.FullName;
}
 

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,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top