refreshing a GridView after submitting data with a FormView
Posted on 2006-04-13
I have a page that uses a GridView to display information out of a table in a database, and a FormView to insert new information into the same table. There is a DropDownList (showing a list of states) that is the control for the GridView. In this case, you pick a state from the DropDownList and see information pertinent to that state in the GridView.
My problem is that whenever I add another record to the table, I can't get the GridView to show the new information until I use the DropDownList to show a different state, then use the DropDownList again to go back to the original state. Is there a parameter, control or property that I can use to automatically update the GridView for the new information?
When you use refresh immediately after submitting data, the GridView does not update. Even worse, the insert runs again, putting another (identical) entry into the table. Refresh won't work.
I am looking for something similar to the AutoPostBack property found in the DropDownList.