Gridview rowupdating error handling

The last thing Grid View_Row Updating() does is call Populate Grid View(), and I can see the data is correct in the database at that time, right before this function below is called.

Row Index is not a member of Grid View Command Event Args. Command Argument seems to hold a string copy of the row number. Row Index, could I go through my code and convert over to: Dim i Row Index as integer = CInt (e. Other commands you can handle include (CASE SENSITIVE unless . To Upper is used) "Cancel", "Update", "Edit", "Delete", "Insert". Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free.So , I'm not adding something to gridview from an event and there's nothing I can catch. Thanks I think you want to define your inserting/inserted handler and the arguments to those handlers contain any exception thrown from the database.

Errors from the database can be handled in the Data Source Control.

SSNO" Hi Stephanie D, You need to bind Grid View in Page_Load event with postback checking: Protected Sub Page_Load(By Val sender As Object, By Val e As Event Args) If Not Is Post Back Then Populate Grid View() End If End Sub Thanks, Hi Qin Dian Tang - thanks for replying to my 5-day old question, I had given up hope!

Chances are it's something goofy that we all missed. I found another intriguing problem in Populate Grid View() - I'll post it in a follow-up reply but here is Page Load() in case there is something wrong there. The Read Cookie() and Build Menus() are harmless - I'm pretty sure they are not part of the problem. The following Sub fills my Grid View from an Access database. After performing an Update and successfully saving all changes to the database (which I verify by opening the tables in Access), the following code stops working. This seems to be a common question - I see two other posts about the exact same problem this morning. Open() 'Use a try/catch/finally here :( 'As is, your Connection won't close if da.

When I click Edit, the page reloads fine with the correct line in Edit mode. Lastname]) as Assigned To Name, [Action Plan], [Machine], [Status], [Closed] FROM (Meeting Action LEFT JOIN Personnel AS u1 ON Meeting Action. So Populate Grid View() is actually getting called twice after the update - once at the end of Row Updating() and then again in Page Load(). You don't want Populate Grid View to be called twice in this case Stephanie, the idea that it is kinda troubles me.

And when I click Update, I step through my code line-by-line and see that the correct data does get sent back to the database correctly (MS Access if it matters). If Not(Is Post Back) is there to prevent the Data Bind from happening since On Row Updating means the postback hasn't occured yet, and is still coming.

Ole Db Connection(str Connect String MAR) ' Prepare a Command Dim db Cmd As New Ole Db. Connection = cn Access ' Create an empty Parameter variable Dim pm As Ole Db.