skip to content »

litmuseyon.ru

Onrowupdating not

onrowupdating not-11

To avoid this we need to keep the property Read Only as false, Then in the edit mode nothing will happenes. The reason I use Template Field instead of Bound Field is that, it is very easy to grab those controls in the codebehind if we user labels or textboxes.

onrowupdating not-62onrowupdating not-8onrowupdating not-65

Now you can ask questions directly to me on my new site ASPForums. The Edit Index property of a Grid View determines the index of a row in edit mode. Update record and get updated state of the Grid View.When a Grid View row is in edit mode then we can update the row's record in the relational database table.The Grid View control is a tabular databound control but sometimes it is used like a spreadsheet control. NET 2.0 and is an improved version of the Data Grid control. We can use this to display data from a database and edit, sort and select the data.Database Table Structure We are using an "EMPLOYEE" table so the "EMPLOYEE" table design is: Design of Grid View We design a Grid View with which we can perform update and delete operations.Now we define a method for opening a connection with the relation database and returns a SQL connection object depending on the connection string that is passed as a parameter of the Sql Connection class constructor.

Delete a Record We can delete a record from the database table by clicking on the delete button that is in the Delete column of the Grid View.

The above piece of code will also do the same as label in Item Template and Textbox in the Edit Item Template.

By default all the boundfields will be trasferred as Textboxes in Edit Mode.

So we need to create a Stored Procedure on which we pass all parameters that are updateable along with the primary key value, in other words the row data's key value that is being updated.

We use the Row Updating event of Grid View to update the record in the database table.

If we use proper command names for the buttons like “EDIT”, “DELETE”, “UPDATE”, “CANCEL” these will also trigger the appropriate Grid View Events.