Hidden fields loose their value on postback, when the container they are placed in, is disabled. However, when they get disabled, their value is kept.
Monday, February 26, 2007
Wednesday, February 21, 2007
Friday, February 09, 2007
Make a page refresh after a form submit
Guess what happens, if you insert new records in a datatable on a button click, then press F5, or the refresh button of the browser?! The same record is going to be inserted again. I found this very annoying.
A simple solution: redirect to the same page at the end of the button click event handler.
private void SaveClicked(object sender, EventArgs e)
{
// insert a record somewhere in a datatable
Response.Redirect(itself); // itself being the URL of the current page
}
Subscribe to:
Posts (Atom)