Start Gridview rowupdating event not handled

Gridview rowupdating event not handled

For example, when clicking the Edit button in an editable Grid View, the record's values are read from the database and displayed in Text Boxes and other Web controls. Later, after the user makes her changes and clicks the Update button, the original values plus the new values are sent to the Business Logic Layer, and then down to the Data Access Layer.

When using optimistic concurrency, the DB direct method overloads that accept Data Rows and Data Tables rather than scalar values) must be changed as well.

To have this Table Adapter employ optimistic concurrency control, simply check the "Use optimistic concurrency" checkbox. Get Product By Product ID(original_product ID) If products.

Figure 6: Enable Optimistic Concurrency Control by Checking the "Use optimistic concurrency" Check Box (Click to view full-size image) Lastly, indicate that the Table Adapter should use the data access patterns that both fill a Data Table and return a Data Table; also indicate that the DB direct methods should be created. Count = 0 Then ' no matching record found, return false Return False End If Dim product As _ Northwind Optimistic Concurrency.

Figure 3: Connect to the Same Northwind Database (Click to view full-size image) Next, we are prompted as to how to query the data: through an ad-hoc SQL statement, a new stored procedure, or an existing stored procedure.

Since we used ad-hoc SQL queries in our original DAL, use this option here as well.

Bromberg's Optmistic Concurrency Updating Logic for a brief look at a number of options). NET Typed Data Set provides one implementation that can be configured with just the tick of a checkbox.

Enabling optimistic concurrency for a Table Adapter in the Typed Data Set augments the Table Adapter's statement, for example, updates the name and price of a product only if the current database values are equal to the values that were originally retrieved when updating the record in the Grid View.

Rather than extend our existing DAL's Table Adapters to use optimistic concurrency (which would necessitate changing the BLL to accommodate), let's instead create a new Typed Data Set named Business Logic Layer class that has the appropriate modifications to support the optimistic concurrency DAL.