Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 28th, 2006, 05:14 AM
Authorized User
 
Join Date: Sep 2006
Location: mumbai, maharashtra, India.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default !!! ERROR In Wrox*PreviousPage.IsCrossPagePostBack

i'm taking my data from one page(Default.aspx) to another page(default2.aspx) on button1_Click(in default.aspx).
for that i have set the PostBackUrl of the Button1 to default2.aspx.
It is working fine.
But suppose if some one is directly trying to access default2.aspx without going through default.aspx then he should be redirected to default.aspx !!! For that i have done the following coding:-


---------------------------------------

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If PreviousPage.IsCrossPagePostBack Then
            Label1.Text = "Hello " & PreviousPage.pp_Textbox1.Text _
                         & "<br/>" & "Date Selected: " &
            PreviousPage.pp_Calendar1.SelectedDate.ToShortDate String()
Else
            Response.Redirect("Default2.aspx")
End If
----------------------------------------

After doing this i set default2.aspx as my start page and then build it.But then it gives me this kind of an error:---------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 11:
Line 12: If PreviousPage.IsCrossPagePostBack Then
Line 13: Label1.Text = "Hello " & PreviousPage.pp_Textbox1.Text & "<br/>" & _
Line 14: "Date Selected: " & PreviousPage.pp_Calendar1.SelectedDate.ToShortDate String()


Source File: c:\inetpub\wwwroot\Examples\WebSite\Default2.aspx. vb Line: 12
--------------------------------------------------------

it says that an object reference has not been set and shows the error on Line: 12, whereas this is the exact solution given in Wrox's Profesional Asp.net 2.0, Chapter 3, and Page 74(It was 'Page.IsCrossPagePostBack' but in errata it is corrected to 'PreviousPage.IsCrossPagePostBack')
!!! Please Help If SomeOne Knows This !!!
__________________
--------------------------------------------------
therez nothin\' as impossible, bcaz the word itself says : \'i\'-\'m\'-\'possible\'


Similar Threads
Thread Thread Starter Forum Replies Last Post
PreviousPage.IsCrossPagePostBack workidoo BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 2 January 9th, 2010 04:29 PM
PreviousPage.IsCrossPagePostBack workidoo ASP.NET 3.5 Professionals 3 November 5th, 2008 05:26 PM
!!! ERROR In Wrox*PreviousPage.IsCrossPagePostBack dagad ASP.NET 2.0 Basics 1 March 22nd, 2007 09:57 AM
PreviousPage.FindControl returns nothing dschips BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 3 March 6th, 2007 08:35 AM
Chapter 3 - Page.IsCrossPagePostBack dpereira BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 9 October 25th, 2006 07:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.