Strange Problem When Using Browser back button

Discussion in 'ASP .Net' started by Mr Newbie, Dec 29, 2005.

  1. Mr Newbie

    Mr Newbie Guest

    OK, I have a fairly simple setup where I have an Index of records which are
    displayed using a datagrid on a page. When you click the link associated
    with a Row (ArticleID) , this ID is passed to a page which creates an new
    Article or Retreive an existing one depending if there is an ArticleID
    passed to it.

    So on my index page the user will be directed to the article page and will
    either pick up an existing one or have a new one created.

    Create New Article Link

    or

    IDno XXX XXX XX
    IDno XXX XXX XX


    So Far So Good. . . . .

    Once the new article is created, the if the user uses the back button to go
    to the index and refreshed it, a new Article is created even though there is
    no code for this on the ArticleIndex.aspx page. It is if the refresh is
    posting the last page and the index. If however, I provide a link on the
    Article page to go back to the index, this problem does not occur.

    Any ideas on this one ????

    Cheers


    --
    Best Regards

    The Inimitable Mr Newbie º¿º
     
    Mr Newbie, Dec 29, 2005
    #1
    1. Advertising

  2. Mr Newbie

    Tim_Mac Guest

    hey mr newbie (dig the signature btw!)
    it would help if you could describe how the sequence of events is performed,
    in terms of the controls used (buttons, linkbuttons, html hyperlinks,
    asp:hyperlinks, etc) and how you use and handle the postbacks in each page.

    from your initial description, i can't imagine why it would be happening.
    is the same article being created when you press back? did you try it with
    IE and Firefox just to be sure it isn't a browser cache problem or
    something?

    hopefully we can figure it out with a little more info on the nuts and bolts
    side of things.
    cheers
    tim

    --------------------------
    blog: http://tim.mackey.ie

    "Mr Newbie" <> wrote in message
    news:...
    > OK, I have a fairly simple setup where I have an Index of records which
    > are displayed using a datagrid on a page. When you click the link
    > associated with a Row (ArticleID) , this ID is passed to a page which
    > creates an new Article or Retreive an existing one depending if there is
    > an ArticleID passed to it.
    >
    > So on my index page the user will be directed to the article page and will
    > either pick up an existing one or have a new one created.
    >
    > Create New Article Link
    >
    > or
    >
    > IDno XXX XXX XX
    > IDno XXX XXX XX
    >
    >
    > So Far So Good. . . . .
    >
    > Once the new article is created, the if the user uses the back button to
    > go to the index and refreshed it, a new Article is created even though
    > there is no code for this on the ArticleIndex.aspx page. It is if the
    > refresh is posting the last page and the index. If however, I provide a
    > link on the Article page to go back to the index, this problem does not
    > occur.
    >
    > Any ideas on this one ????
    >
    > Cheers
    >
    >
    > --
    > Best Regards
    >
    > The Inimitable Mr Newbie º¿º
    >
     
    Tim_Mac, Dec 29, 2005
    #2
    1. Advertising

  3. Mr Newbie

    Mr Newbie Guest

    Thanks for your reply.

    This does not happen with NN ( not sure about FF ). With IE, it does give
    the message when the refresh is attempted which says something like. "You
    will have to resubmit the form", this does not get asked with NN.

    I think what is happening is that the last form is resumitted ( Artice
    Form ) even though it is the Index form which is currently being displayed.

    As for describing the events.

    Index Page_Load
    'Fill the datagrid with all articles.
    'Thats it.

    Article Page_Load

    If this is postback then retreive Article and Sections from Session

    Else

    If an ArticelID was passed then
    retreive the Articel and Sections from the SQL Server
    else
    Create new Articele Store in Database.
    End If

    Store Article and Section Info In Session

    End If


    Hope this gives u something to go with.

    --
    Best Regards

    The Inimitable Mr Newbie º¿º
    "Tim_Mac" <Tim at mackey dot eye eee> wrote in message
    news:%...
    > hey mr newbie (dig the signature btw!)
    > it would help if you could describe how the sequence of events is
    > performed, in terms of the controls used (buttons, linkbuttons, html
    > hyperlinks, asp:hyperlinks, etc) and how you use and handle the postbacks
    > in each page.
    >
    > from your initial description, i can't imagine why it would be happening.
    > is the same article being created when you press back? did you try it
    > with IE and Firefox just to be sure it isn't a browser cache problem or
    > something?
    >
    > hopefully we can figure it out with a little more info on the nuts and
    > bolts side of things.
    > cheers
    > tim
    >
    > --------------------------
    > blog: http://tim.mackey.ie
    >
    > "Mr Newbie" <> wrote in message
    > news:...
    >> OK, I have a fairly simple setup where I have an Index of records which
    >> are displayed using a datagrid on a page. When you click the link
    >> associated with a Row (ArticleID) , this ID is passed to a page which
    >> creates an new Article or Retreive an existing one depending if there is
    >> an ArticleID passed to it.
    >>
    >> So on my index page the user will be directed to the article page and
    >> will either pick up an existing one or have a new one created.
    >>
    >> Create New Article Link
    >>
    >> or
    >>
    >> IDno XXX XXX XX
    >> IDno XXX XXX XX
    >>
    >>
    >> So Far So Good. . . . .
    >>
    >> Once the new article is created, the if the user uses the back button to
    >> go to the index and refreshed it, a new Article is created even though
    >> there is no code for this on the ArticleIndex.aspx page. It is if the
    >> refresh is posting the last page and the index. If however, I provide a
    >> link on the Article page to go back to the index, this problem does not
    >> occur.
    >>
    >> Any ideas on this one ????
    >>
    >> Cheers
    >>
    >>
    >> --
    >> Best Regards
    >>
    >> The Inimitable Mr Newbie º¿º
    >>

    >
    >
     
    Mr Newbie, Dec 29, 2005
    #3
  4. Mr Newbie

    Tim_Mac Guest

    hi,
    it sounds like you are using a button or linkButton in the datagrid on the
    index page, to select the item and redirect to the article page? when you
    do it this way, you are obviously causing a postback on the index page, and
    then a redirect to the article page.
    the way IE sees these events in terms of browser history is:

    Index Page > Index Page (PostBack) > Article Page

    so when you click back from the Article page, you are only going back to the
    Postback. i'm guessing Netscape sees it as:

    Index Page > Article Page

    and doesn't bother counting the postback to the same page in the browser
    history, which i think is smart.

    you could change from a Button to a plain old Html Hyperlink in the
    datagrid, which will just redirect the user because they clicked on a link,
    not because they caused a form postback. this way the browser back/forward
    should work fine in any browser.

    let me know if i am understanding the situation properly
    thanks
    tim
     
    Tim_Mac, Dec 29, 2005
    #4
  5. Mr Newbie

    Mr Newbie Guest

    You are understanding it correctly. Im not sure how I can use a plain
    hyperlink as I need the articleID to pass as the parameter, so how would I
    get that from the table ? - Have not thought it through yet !

    --
    Best Regards

    The Inimitable Mr Newbie º¿º
    "Tim_Mac" <Tim at mackey dot eye eee> wrote in message
    news:...
    > hi,
    > it sounds like you are using a button or linkButton in the datagrid on the
    > index page, to select the item and redirect to the article page? when you
    > do it this way, you are obviously causing a postback on the index page,
    > and then a redirect to the article page.
    > the way IE sees these events in terms of browser history is:
    >
    > Index Page > Index Page (PostBack) > Article Page
    >
    > so when you click back from the Article page, you are only going back to
    > the Postback. i'm guessing Netscape sees it as:
    >
    > Index Page > Article Page
    >
    > and doesn't bother counting the postback to the same page in the browser
    > history, which i think is smart.
    >
    > you could change from a Button to a plain old Html Hyperlink in the
    > datagrid, which will just redirect the user because they clicked on a
    > link, not because they caused a form postback. this way the browser
    > back/forward should work fine in any browser.
    >
    > let me know if i am understanding the situation properly
    > thanks
    > tim
    >
     
    Mr Newbie, Dec 29, 2005
    #5
  6. Mr Newbie

    Tim_Mac Guest

    hi,
    i use something like this:

    <asp:TemplateColumn HeaderText="ID">
    <ItemTemplate>
    <a href='Edit_Email.aspx?ID=<%# DataBinder.Eval(Container,
    "DataItem.ID") %>'>
    <%# DataBinder.Eval(Container, "DataItem.ID") %>
    </a>
    </ItemTemplate>
    </asp:TemplateColumn>

    is this possible in your situation?
    tim

    --------------------------
    blog: http://tim.mackey.ie

    "Mr Newbie" <> wrote in message
    news:%...
    > You are understanding it correctly. Im not sure how I can use a plain
    > hyperlink as I need the articleID to pass as the parameter, so how would I
    > get that from the table ? - Have not thought it through yet !
    >
    > --
    > Best Regards
    >
    > The Inimitable Mr Newbie º¿º
    > "Tim_Mac" <Tim at mackey dot eye eee> wrote in message
    > news:...
    >> hi,
    >> it sounds like you are using a button or linkButton in the datagrid on
    >> the index page, to select the item and redirect to the article page?
    >> when you do it this way, you are obviously causing a postback on the
    >> index page, and then a redirect to the article page.
    >> the way IE sees these events in terms of browser history is:
    >>
    >> Index Page > Index Page (PostBack) > Article Page
    >>
    >> so when you click back from the Article page, you are only going back to
    >> the Postback. i'm guessing Netscape sees it as:
    >>
    >> Index Page > Article Page
    >>
    >> and doesn't bother counting the postback to the same page in the browser
    >> history, which i think is smart.
    >>
    >> you could change from a Button to a plain old Html Hyperlink in the
    >> datagrid, which will just redirect the user because they clicked on a
    >> link, not because they caused a form postback. this way the browser
    >> back/forward should work fine in any browser.
    >>
    >> let me know if i am understanding the situation properly
    >> thanks
    >> tim
    >>

    >
    >
     
    Tim_Mac, Jan 1, 2006
    #6
    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. Earl Teigrob
    Replies:
    1
    Views:
    1,305
    Earl Teigrob
    Dec 18, 2003
  2. Todd A
    Replies:
    1
    Views:
    2,248
    bruce barker
    Dec 3, 2004
  3. sylvia sil
    Replies:
    1
    Views:
    652
    Curt_C [MVP]
    Dec 29, 2004
  4. Author
    Replies:
    6
    Views:
    3,276
    George
    Jan 22, 2009
  5. P E Schoen
    Replies:
    0
    Views:
    673
    P E Schoen
    Mar 7, 2012
Loading...

Share This Page