Setting and querying page variables during AJAX postbacks in asp.net
Posted on 2008-11-03
I have a form that when submitted summerises the information in a table and hides the form. The idea is if the user wants to edit anything they could press a button and it'll make the form visible again so thay could alter things and re-submit.
My problem is... I need the page to know whether the form is a new submission or if the user is editing an old one.
The submit button creates an AJAX postback, which runs a button_click event in the code behind. I have some variables declared at the top of the code-behind page where I'll set 'IsNewOrder' to false. The idea being that if the user edits the form and re-posts it, the code behind will check the 'IsNewOrder' bool and behave differently to an edit than a new order.
I hope this makes sense... it seems that the AJAX postback can't access the 'IsNewOrder' variable in the code-behind. So the page thinks it's a new form submission every time. Maybe one way is to have an invisible check box in the UpdatePanel and use that to see if it's a new submission?
Is there an easier or more logical way that I'm missing?