CrossPage Posting and the How Do I Webcast

Discussion in 'ASP .Net Web Controls' started by Marcial, Mar 20, 2006.

  1. Marcial

    Marcial Guest

    The following code is supposed to allow me to capture some label.text values
    from a preceeding page. I have placed a link button control on "source page"
    and configured the PostbackUrl property to point to the "destination page".
    On the destination page I would like to retrieve the text values from the
    "source page" and use them as needed. This is the basic functionality of
    Crosspage posting as I understand it.

    However when I run the page and click the link button I am preented wtih an
    error:

    NullReference was unhandled by the user code.
    Object reference not set to an instance of an object.

    The code below was based on an ASP.NET 2.0 How Do I Vidoe Series: Tips and
    Tricks. after viewin g the souce code and search a bit fro how to debugg it
    I tried adding the New keyword declarations. However the error above
    contiues to appear.

    Now that i've exposed myself as the newbie that i am can someone explain the
    obvious to me.

    Thanks in advance!

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Handles Me.Load
    If Not Page.IsPostBack Then

    Dim c As New Label
    Dim s As New Label

    c.Text = Nothing
    s.Text = Nothing

    c = CType(PreviousPage.FindControl("CaseCounterLabel1"), Label)
    s = CType(PreviousPage.FindControl("lblSpecies"), Label)

    lblCaseCounter.Text = String.Format("Case Number {0}", c.Text)
    lblSp_Cd.Text = String.Format("Species {1}", s.Text)

    End If
    End Sub
    --
    Application Engineer / DBA
    UCLA SOM
     
    Marcial, Mar 20, 2006
    #1
    1. Advertising

  2. Marcial

    Guest

    lblSp_Cd.Text = String.Format("Species {1}", s.Text)
    Should be
    lblSp_Cd.Text = String.Format("Species {0}", s.Text)

    Lookup String.Format in MSDN if you want more information.
     
    , Mar 20, 2006
    #2
    1. Advertising

  3. Marcial

    Marcial Guest

    Unfortunately changing the {1} to [0} did not work.
    I reviewed the String.format method and am still suffering from a mental
    block on what step I'm missing.
    --
    Application Engineer / DBA
    UCLA SOM


    "" wrote:

    > lblSp_Cd.Text = String.Format("Species {1}", s.Text)
    > Should be
    > lblSp_Cd.Text = String.Format("Species {0}", s.Text)
    >
    > Lookup String.Format in MSDN if you want more information.
    >
    >
     
    Marcial, Mar 21, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean W, Smith
    Replies:
    0
    Views:
    462
    Sean W, Smith
    Dec 7, 2004
  2. Replies:
    0
    Views:
    2,333
  3. =?Utf-8?B?Q2hhcmxlc0E=?=

    crosspage posting (smallish) problem

    =?Utf-8?B?Q2hhcmxlc0E=?=, Feb 15, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    419
    Teemu Keiski
    Feb 16, 2007
  4. STDFJoshua

    ASP.Net CrossPage Posting How?

    STDFJoshua, Jun 9, 2008, in forum: .NET
    Replies:
    0
    Views:
    377
    STDFJoshua
    Jun 9, 2008
  5. Yankee Imperialist Dog

    cancel a crosspage post back in the event?

    Yankee Imperialist Dog, Jun 16, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    316
    Yankee Imperialist Dog
    Jun 16, 2008
Loading...

Share This Page