468,760 Members | 1,800 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,760 developers. It's quick & easy.

Strange Problem When Using Browser back button

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
Dec 29 '05 #1
5 1742
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" <he**@now.com> wrote in message
news:OO**************@TK2MSFTNGP14.phx.gbl...
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

Dec 29 '05 #2
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:%2***************@TK2MSFTNGP10.phx.gbl...
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" <he**@now.com> wrote in message
news:OO**************@TK2MSFTNGP14.phx.gbl...
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


Dec 29 '05 #3
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
Dec 29 '05 #4
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:Ot*************@tk2msftngp13.phx.gbl...
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

Dec 29 '05 #5
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" <he**@now.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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:Ot*************@tk2msftngp13.phx.gbl...
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


Jan 1 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by guoqi zheng | last post: by
2 posts views Thread by COHENMARVIN | last post: by
1 post views Thread by Rob | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.