Strange Problem When Using Browser back button

M

Mr Newbie

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
 
T

Tim_Mac

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
 
M

Mr Newbie

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.
 
T

Tim_Mac

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
 
M

Mr Newbie

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 !
 
T

Tim_Mac

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top