Hi
I have a peculiar problem. I created an ASP.Net page with the code behind in C#. After submitting I am storing the primary key value of the row inserted in a ViewState variable. Then I pass this as a query string and do a Response.Redirect() to another page. Then I use the browser back button to come back to the previous page. I click submit again. In the submit routine I am unable the get the same value I stored earlier in the Viewstate variable for the page. My aim is this. To prevent submitting again when clicking the submit button. For this I need to store the primary key to check whether it exists in the database after navigating by the back button. Can you help?

Thanks

ViewState can be very tricky. Try using a Session state variable for this, or, the tried-and-true method of writing a cookie instead.

Hi
Thanks for your feedback. I was curious whether ASP.Net has any other way of handling this issue I did not know. I will try with session or cookie. Thanks once again

Jayakumar

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.