Sunday, October 14, 2012

Preventing Duplicate Record Insertion on Page Refresh — asp.net gridview


ASP.NET Gridview:
One of most common issue which many of the web developers face in their asp.net gridview applications, is that the duplicate records are inserted to the Database on page refresh.
working on asp.net C# ….Under button click event i want to save something it’s work fine ….but after press the refresh button of browser then duplicate value insert ,how can stop this event….
Solve:
just adding the following code :

System.Web.HttpContext.Current.Response.Redirect(Request.RawUrl);

in the bottom of your insert method.

I think your problem will be solve  :)

1 comment:

  1. it only works if the record goes to database on each row save

    ReplyDelete