IsCrossPostBack always return false

Discussion in 'ASP .Net' started by Lore, Jun 16, 2006.

  1. Lore

    Lore Guest

    I've been trying for a while, but unfortunately I can't get a
    solutions, neighter I was able to find it in google.

    In the CrossPostBack referred page the property IsCrossPostBack is
    always set to false, while it should be set to true if the
    CrossPostBack occured: is there anybody who can explain me why?

    Thanks,
    Lorenzo
     
    Lore, Jun 16, 2006
    #1
    1. Advertising

  2. Lore

    Teemu Keiski Guest

    Hi,

    usage of IsCrossPagePostBack is a bit weird. You don't check it from Page
    but from PreviousPage property.

    Say on page1.aspx you have

    <asp:Button ID="Button1" runat="server" Text="Button"
    PostBackUrl="page2.aspx" />

    And on page2.aspx in code

    If Not Page.PreviousPage Is Nothing Then

    If PreviousPage.IsCrossPagePostBack Then
    Response.Write("It is a cross-page postback")
    End If
    'Essentially this means that IsCrossPagePostBack property is
    sort of clumsy
    'If PreviousPage property is non-null, that's already enough to
    know it's a cross-page post
    End If

    If you use C# then it's just checking if(PreviousPage != null){...} and so
    on

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke



    "Lore" <> wrote in message
    news:...
    > I've been trying for a while, but unfortunately I can't get a
    > solutions, neighter I was able to find it in google.
    >
    > In the CrossPostBack referred page the property IsCrossPostBack is
    > always set to false, while it should be set to true if the
    > CrossPostBack occured: is there anybody who can explain me why?
    >
    > Thanks,
    > Lorenzo
    >
     
    Teemu Keiski, Jun 17, 2006
    #2
    1. Advertising

  3. Lore

    Teemu Keiski Guest

    To add,

    it's essentially that source page's IsCrossPagePostBack is true. Reason is
    that posting to second page also invokes the original posting page, and
    there you might need the info if it's participating a cross-page post or
    not.

    Of course PreviousPage could be non-null when ttere's also Server.Transfer.
    See:
    http://msdn2.microsoft.com/en-us/library/ms178141.aspx
    http://msdn2.microsoft.com/en-US/library/ms178139.aspx


    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke

    "Lore" <> wrote in message
    news:...
    > I've been trying for a while, but unfortunately I can't get a
    > solutions, neighter I was able to find it in google.
    >
    > In the CrossPostBack referred page the property IsCrossPostBack is
    > always set to false, while it should be set to true if the
    > CrossPostBack occured: is there anybody who can explain me why?
    >
    > Thanks,
    > Lorenzo
    >
     
    Teemu Keiski, Jun 17, 2006
    #3
  4. Lore

    Lorenzo Guest

    Thank you very much.

    Lorenzo
    "Teemu Keiski" <> ha scritto nel messaggio
    news:...
    > To add,
    >
    > it's essentially that source page's IsCrossPagePostBack is true. Reason is
    > that posting to second page also invokes the original posting page, and
    > there you might need the info if it's participating a cross-page post or
    > not.
    >
    > Of course PreviousPage could be non-null when ttere's also
    > Server.Transfer. See:
    > http://msdn2.microsoft.com/en-us/library/ms178141.aspx
    > http://msdn2.microsoft.com/en-US/library/ms178139.aspx
    >
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > http://blogs.aspadvice.com/joteke
    >
    > "Lore" <> wrote in message
    > news:...
    >> I've been trying for a while, but unfortunately I can't get a
    >> solutions, neighter I was able to find it in google.
    >>
    >> In the CrossPostBack referred page the property IsCrossPostBack is
    >> always set to false, while it should be set to true if the
    >> CrossPostBack occured: is there anybody who can explain me why?
    >>
    >> Thanks,
    >> Lorenzo
    >>

    >
    >
     
    Lorenzo, Jun 19, 2006
    #4
    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. Replies:
    5
    Views:
    1,311
    Tony Morris
    Apr 26, 2006
  2. zino
    Replies:
    3
    Views:
    1,919
  3. w i l l
    Replies:
    4
    Views:
    273
    Dan Brussee
    Jul 4, 2003
  4. Replies:
    1
    Views:
    476
    Randy Webb
    Oct 6, 2005
  5. Replies:
    10
    Views:
    332
    Thomas 'PointedEars' Lahn
    Feb 16, 2006
Loading...

Share This Page