Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Nó cung cấp cho bạn một phần 6 chương về lập trình cơ sở dữ liệu đó là hướng đến các ứng dụng kinh doanh Cơ sở dữ liệu xử lý là rất quan trọng trong lập trình kinh doanh, nhưng nó glossed trên trong một chương hoặc hai trong nhiều sách. | Chapter 15 How to use the DetailsView and FormView controls 497 Events raised by the DetailsView control Event Description ItemCommand Raised when a button is choked. ItemCreated Raised when an item is created. DataBound Raised when data binding completes for an item. ItemDeleted Raised when an item has been deleted. ItemDeleting Raised when an item is about to be deleted. Itemlnserted Raised when an item has been inserted. Iteminserting Raised when an item is about to be inserted. ItemUpdated Raised when an item has been updated. Itemupdating Raised when an item is about to be updated. PagelndexChanged PagelndexChanging Raised when the index of the displayed item has changed. Raised when the index of the displayed item is about to change. An event handler for the Itemllpdated event Protected Sub DetailsViewlItemUpdated ByVai sender As Object ByVai e As System.Web.UI.WebControls.DetailsViewUpdatedEventArgs Handles DetailsViewl.ItemUpdated If e.Exception IsNot Nothing Then IblError.Text A database error has occurred. e.Exception.Message e.ExceptionHandled True Elself e.AffectedRows 0 Then IblError.Text Another user may have updated that product. Please try again. Else ddlProducts.DataBind End If End Sub Description Like the Gridview control the Details View control raises events that can be handled when data is updated. At the minimum you should use these events to test for database exceptions and concurrency errors. To determine if a SQL exception has occurred test the Exception property of the e argument. If an exception has occurred you can set the ExceptionHandled property to True to suppress the exception. You can also set the KeepInEditMode property to True to keep the Details View control in Edit mode. And you can set the KeepInlnsertMode property to True to keep the control in Insert mode. If the AffectedRows property of the e argument is zero and an exception has not been thrown a concurrency error has probably occurred. If the DetailsView control is used .