i have applied edit,delete,update,insert operation successfully,everything is work Correctly.
But when i refresh the page,last operation performed again after refresh .
suppose when i updated any record before refresh ,one insertion took place after refresh .
when i inserted record before refresh page.same record inserted again...i have no idea why has been this happening.
if anybody want to see my code,i will show..
Thanks in advance
Problem in Gridview when refresh page..
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Abhay ShankerRank #375 · 6.7K reputationPosted Mar 18, 2014, 9:40 PM EDT
If you refresh the page,last operation performed again which is adding a record to the db in this case.
You have to check with the db for the existence of the record before inserting it to avoid this.
Secondly, If you need your Gridview to be updated with last entered value you need to re-bind the Gridview after entering the record.
Remove the databinding code from Page_Init method and create a new method with same code say BindGrid() on Page_Load
Also, add BindGrid(); as the last line of Button1_Click() method
Sompal AryaRank #3,964 · 375 reputationPosted Mar 18, 2014, 9:53 PM EDT
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Mar 18, 2014, 11:27 PM EDT
Sompal AryaRank #3,964 · 375 reputationPosted Mar 18, 2014, 11:47 PM EDT