Wednesday, October 11, 2006

Gridview and Refresh

I ran into an interesting problem. I set up a normal editable gridview using the footer to enter an inserted record. It worked fine under normal conditions. A user did a browser refresh after the insert and another record was created. It makes sense since the refresh just causes another insert event to occur.

The solution I created was to use a Session variable to detect if the last event was an insert and in the insert event handler, just reset the gridview data source to a the table created by the object data source control's select method and rebind the gridview if the Session variable detected a refresh.

No comments: