Next, pare down the Details View so that it only has two Bound Fields - Figure 16 shows this page when viewed through a browser at this point.As you can see, the Details View lists the name and price of the first product (Chai).Similarly, if there is some combination of non-read-only product fields in the Grid View that doesn't correspond to the input parameters for a overload, allows a user to edit just the name and price of a product without losing any of the other product fields.Figure 6: The Interface Allows Editing Just the Product's Name and Price (Click to view full-size image) , you run the risk of having concurrent users unintentionally deleting or editing records. NET 2.0 Grid Views/Details View/Form Views that Support Editing and/or Deleting and Whose View State is Disabled for more information.In this tutorial we'll examine using the events that occur before, during, and after an insert, update, or delete operation of an ASP. We'll also see how to customize the editing interface to only update a subset of the product fields.When using the built-in inserting, editing, or deleting features of the Grid View, Details View, or Form View controls, a variety of steps transpire when the end user completes the process of adding a new record or updating or deleting an existing record.The event handlers for these three events are passed an object of type Object Data Source Method Event Args that has two properties of interest: To illustrate working with the parameter values at the Object Data Source level, let's include a Details View in our page that allows the users to add a new product.
To configure the Object Data Source, select the Configure Data Source link from its smart tag, launching the wizard.
Figure 12: A Label Has Been Added Above the Grid View (Click to view full-size image) By default, this Label should be hidden, so set its collection as well as how to cancel the updating process altogether.
These concepts carry over to the Details View and Form View controls and also apply to inserting and deleting.
Go to the Source view to inspect the Object Data Source's declarative markup, which is shown below: property value from the Properties window in the Design view, the property will still exist in the declarative syntax, but will be set to an empty string.
Either remove the property altogether from the declarative syntax or, from the Properties window, set the value to the default, for the product's name, price, and ID, Visual Studio has added a Bound Field or Check Box Field in the Grid View for each of the product's fields.