Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Refreshing a page causes databound gridview to re update datasource.

Reply
Thread Tools

Refreshing a page causes databound gridview to re update datasource.

 
 
Mike Grace
Guest
Posts: n/a
 
      05-08-2006
Hi,

I have a gridview which is using a SqlDataSource to update a table.

The SqlDatasource is using a stored procedure to update the table.

If I edit a row, change a value and click update the change is successfully
applied to the SQL table.

After this, the values in the underlying table could be changed by another
process

If I click the refresh button, when the page is redisplayed (after clicking
retry on the warning), the underlying table is updated with the old values
that were in the grid.

This is obviously very dangerous.

How can I stop this from happening?

Surely when the page is refreshed, it shouldn't reapply the updates or am I
missing something.


Regards


Mike


 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      05-12-2006
> Surely when the page is refreshed, it shouldn't reapply the updates or
> am I missing something.


Have you ever read the dialog that pops up when you try to refresh after
you've previously submitted a form? The dialog usually tries to tell you
that if you hit "OK" you're going to cause the browser to repeat thelast
thing you did, which was a submit. This is a problem and is solved by either
1) user education, or if that's difficult 2) after the submit and all your
data's been saved to the database, use something like Response.Redirect(Request.Path)
to get the user back to a 'fresh' page.

-Brock
http://staff.develop.com/balle


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing the page causes resubmission the form ritika_v ASP .Net 1 04-01-2008 02:18 PM
databound custom controls vs composite databound custom controls rodchar ASP .Net 0 11-26-2007 03:51 PM
Gridview row databound event - can't get past the 1st row of gridview maurban@gmail.com ASP .Net 5 10-13-2006 09:37 PM
Self-refreshing and non-self-refreshing controls Harlan Messinger ASP .Net 1 08-04-2006 01:13 PM
templated databound control problem - not showing databound Manu ASP .Net Web Controls 0 05-22-2006 09:46 AM



Advertisments