Solved

Why the gridView_RowUpdating events get hit again when I refresh the page after it completed the update?

Posted on 2014-12-22
2
244 Views
Last Modified: 2014-12-26
Hi, I'm using VS2012.

After the end of the gridView_RowUpdating, I set the EditIndex to -1.  Doesn't this signal that updating event is completed?  The gridview returns to the original state and the UPdate and Cancel button goes away.  I then click Refresh (in the browser next to the url) icon to refresh the page, then it hit my break point in VS that is in gridView_RowUpdating event.  

Why is it hitting that updating event code again?  How to fix this?  Thank you.
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Assisted Solution

by:Mike Eghtebas
Mike Eghtebas earned 200 total points
ID: 40514424
let's have a Boolean variable (bolBypass) to be set to true or false (in postback == true or postback != true whichever you are using).

Then use:
if bolBypass== true 
{
// run your update routine
bolBypass = false  // this resetting will prevent update running for 2nd time
}

Open in new window


You need to figure out the location and setting of  bolBypass = ? in your  postback == true or postback != true.
0
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 300 total points
ID: 40515840
Tricky hard to say without looking at the whole page code,
if your code is firing two times only, then your issue may get solved as follows:
1) Check that your event handler is not being set more than once in your site.
For example you may be defining the handler on your grid view mark-up and C#code.
2) Check that your code is not updating the database after the data is bound to the grid view.
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question