Server Transfer doesn't Set Focus to Page

J

Jim Bayers

This has been driving me crazy. server.transfer doesn't set the focus
to the page I transfer to so when the user does a refresh, the results
aren't what's expected.

I have a datagrid on one page that lists the student's guests. At the
bottom of the datagrid is an 'add a new guest' button. Users click on
this button an it takes them to a new page where they can add a new
guest. So they type in the guest information and click on the 'save'
button. server.transfer takes them back to the datagrid page where
their guest is listed.

Simple enough, right? The problem is, after you save a guest and return
to the datagrid page, when the user refreshes, it adds the same guest to
the datagrid, creating a duplicate guest entry. It took me a long time
to figure out what is happening. The focus is still on the 'add a
guest' page so when you refresh, it's just like clicking on the 'save'
button.

How do I set the focus to the datagrid page after I save a guest? I
need to use server transfer.
 
G

Guest

It is setting focus, but a refresh forces the same action when you have the
form linked via Server.Transfer(). I would consider going to
Response.Redirect instead as a refresh will only refresh the page rather than
rerun the form submit.

The action you are speaking of is normal, as the browser is asking for a
refresh on the entire process, as it does not realize it has been transfered
on the server side.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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

Top