Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conflicts of two buttons in one page

Status
Not open for further replies.

seaport

MIS
Jan 5, 2000
923
US
I am using ASP.net 2.0. There are two buttons in a page - Page 1. One button - Button A - does a postback and refreshes a gridview in that page. The other - Button B - makes a cross-page post back to another page - Page 2.

Here is the conflict. After I get to Page 2, I click "Back" button on the browser to go back to Page 1. (I do not want to refresh Page 1 so my entries in Page 1 can be preserved.) Then I click Button A. Instead of refreshing the gridview, I am led to Page 2 as if I clicked on Button B.

I figured, when I clicked on Button B the first time, a hidden field in Page 1 was written (by javascript generated by ASP.net). This way the server knows that the post back is for another page. That hidden field was not cleared when I went back to Page 1 and clicked Button A.

My idea to go around this is to make the Button A as cross-page post-back to itself. However, I need to add some codes so entries in Page 1 can be preserved during this cross-page postback.

Any better idea?

Seaport
 
Here is an update.

My idea turns out to resolve the problem. Surprising to me, after I made the Button A as cross-page post-back to itself, user entries in Page 1 were preserved during this cross-page postback.

Seaport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top