Reputation: 9617
I have a button in my aspx page, which in code behind the value of postbackurl gets set. I updated the code to add click event handler and added Response.Redirect code to redirect user to the page once the button is clicked. The only reason i ended up adding click event was because i had to add some extra logic when the button was clicked including redirecting to same url, that was used in postbackurl. The page does get redirected on click however it seems like all the hidden fields from the field gets lost once the form get redirected to the url. Is there anyway i can submit the form without loosing the hidden data.?
Upvotes: 0
Views: 2184
Reputation: 1
There is a way you can submit the form without loosing the hidden data.
You can use PostbackUrl="~/navigationPage.aspx"
attributes in an asp button controls to retrieve a hidden field value
from another page. It will ensure a lossless data retrieval instead of
button_click
event.
Upvotes: 0
Reputation: 70538
Maybe one way you can solve this problem is to use the server side Transfer() call.
http://msdn.microsoft.com/en-us/library/540y83hx(v=vs.85).aspx
In most cases I've seen what you really want to do is pass the information for the new page using URL parameters. Take all the stuff the new page needs and put it into the url (encrypt if it is security sensitive).
If the only issue you are having is when you want to stay on the same page, this is simple, just have the click event handler return without doing a response.redirect or a transfer.
Post the code if this is not working for you.
Upvotes: 1