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.

You can see the C# code below will give the row number whatever you are editing by New Edit Index property.

So Grid View will put the appropriate row into the Edit Mode by assigning row number to its Edit Index property. You can follow any responses to this entry through the RSS 2.0 feed.

I just want to make them clear this question (going to explain it at the end of the article) because, I am going to use Template Fields again in this article 🙂 TASK: In this article we are trying to display some information from Adventure Works database, Employee table, and if the employee pay rate is more than 25 we are going to change the color of the row/cell/text.

Here is the html markup for the grid The Above markup is pretty simple if you follow my previous article as I just used template field’s and Item templates. If we want to modify data or check certain conditions before displaying it to the user this is the correct place to do the changes.

Using the Ole Db Data Adapter, you can fill a memory-resident Data Set that you can use to query and update the data source.

For information about how to use this namespace, see the Ole Db Data Adapter, Ole Db Data Reader, Ole Db Command, and Ole Db Connection classes.

In order to do so select “Edit Columns…” from the smart tag of the Grid View. Select Company Name and Contact Name fields and click on “Covert this field into a Template Field” link.

This will convert them from Bound Field to Template Field.

May be you may think why am I using link buttons as we are provided with some command field buttons by Grid View.

Secondly if you want to include a custom field (some button or link) in the same column it’s not possible.

Now from the smart tag of the Grid View choose “Edit Template” and then select “Edit Item Template” of Company Name column.