Modify field at gridview1 rowupdating event

We define a connection in the web.config file and give a name to the connection string.

Now we access this connection string on the page so we can open a connection with the relation database. The first one accesses the connection string and the other is for the SQL connection.

Every one can use it to compare the new value with old ones.

modify field at gridview1 rowupdating event-64

In data driven web sites, users are normally allowed to view data and administrators are allowed to add, edit or delete data.

In this tutorial I will show you how you can create an editable Grid View control for administrators to modify database records directly into the Grid View control.

I am using Template Field’s Item Template and Edit Item Template for providing read only and editing interface of the same column in the Grid View.

By Default, Grid View control displays Item Template which directly shows the Product Name and Unit Price columns but when user clicks Edit button Grid View automatically switches to Edit Item Template and display the control available inside Edit Item Template for user editing.

Font-Names="Verdana" Font-Size="10" Data Key Names="Product ID" Auto Generate Columns="false" onrowcancelingedit="Grid View1_Row Canceling Edit" onrowediting="Grid View1_Row Editing" onrowupdating="Grid View1_Row Updating"In the above code, I set two properties Show Edit Button and Show Cancel Button of Command Field.

These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.

Here we can update Name, Emp_Code and Emp_Age fields depending on the Id field of the "EMPLOYEE" table.

Create SQL Connection We need a connection with a Microsoft SQL Server database so we can access data and perform an operation on it.

Now I will show you the C# code behind file of the above ASP.

For a while now I’m trying to figure out why my method, triggered by the Grid View.

However wen I click on Update nothin happens, currently it isn't connected to the database I just want it to change the text of a button so I know the update works.

Tags: , ,