Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > problem with datasource being updated when the page is refreshed (Gridview)

Reply
Thread Tools

problem with datasource being updated when the page is refreshed (Gridview)

 
 
Mike Grace
Guest
Posts: n/a
 
      05-05-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 are 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.

Regards


Mike



 
Reply With Quote
 
 
 
 
Code Rodent
Guest
Posts: n/a
 
      05-05-2006
Young Michael,

What I normally do for this kind of situation is add a last updated
timestamp to the database table, and use this timestamp as part of the where
clause when updating the row. Sorry I rather sidetracked your original
question!

Hope this helps

Andy


1. Force the page to expire so that it
"Mike Grace" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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 are 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.
>
> Regards
>
>
> Mike
>
>
>



 
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
How to keep Firefox from being refreshed? philb@erwoi.com Firefox 1 03-06-2013 02:55 AM
Button Click Event Procedure being called when a Page is refreshed. Kuldeep ASP .Net 1 05-29-2007 02:31 PM
recordset being displayed isn't refreshed brendan.wong@gmail.com ASP General 2 03-28-2007 11:19 PM
problem with datasource being updated when the page is refreshed (Gridview) Mike Grace ASP .Net 5 05-05-2006 04:05 PM
Maintaining user entered data on a page being refreshed SSS ASP .Net 4 04-13-2006 10:18 AM



Advertisments