1,105,447 Community Members

Stop page refresh

Member Avatar
jrosh
Junior Poster
194 posts since Sep 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I use Mvc 4 with razor. I have a View that in back end creates a database entry in Action method. Problem is when i refresh the page (Press F5) the back end method calls again and create duplicate of the database entry. How to stop this?

 public ActionResult SummaryPage()
 { 
    bool createdatabaseEntry = NotifyCreateDatabaseEntry();

   if (createdatabaseEntry)
    {
        // pop up success massage
    }
    else
    {
        // pop up error massage
    }

     return View();
 }

 public bool createdatabaseEntry : this method connect to the db

Please help
thank you in advance

LastMitch
Deleted Member
 
0
 

I have a View that in back end creates a database entry in Action method. Problem is when i refresh the page (Press F5) the back end method calls again and create duplicate of the database entry. How to stop this?

Read this ( it will explain how to avoid duplicate ):

http://forums.asp.net/t/1848294.aspx/1?Best+practice+to+Avoid+Duplicate+record+insertion+on+page+refresh

Also read this

http://aspalliance.com/687_Preventing_Duplicate_Record_Insertion_on_Page_Refresh

and this:

http://www.dotnetvishal.com/2012/10/avoid-duplicate-record-insertion-on.html

Both links have examples which you can used to prevent duplicate records

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article