# VBForums CodeBank > CodeBank - ASP / ASP.NET / MVC / Web API >  Read-only column on GridView Row Editing

## KGComputers

Here's how to make a specific gridview column read only when a gridview row editing event has been triggered.
See RowCreated event on making a gridview column read only.


vb.net Code:
Protected Sub gvDetails_RowCreated(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvDetails.RowCreated        For Each cell As TableCell In e.Row.Cells            If ((Not String.IsNullOrEmpty(cell.Text)) And (cell.Text <> "&nbsp;")) Then                Dim fld As BoundField                fld = DirectCast(DirectCast(cell, DataControlFieldCell).ContainingField, BoundField)                If fld.DataField = "CustomerID" Then                    fld.ReadOnly = True                End If            End If        Next    End Sub

KGC

Sample Code: ASP.NET in VB
- VS 2010
- ADO.NET Entity Framework
- Northwinds Database

----------

