Live Chat Icon For mobile
Live Chat Icon

How to get the DataField name of a BoundColumn from code-behind

Platform: ASP.NET| Category: DataGrid

Try
[VB.NET]


Dim bc As BoundColumn = CType(Me.DataGrid1.Columns(1), BoundColumn)
Response.Write(bc.DataField)

[C#]


BoundColumn bc = (BoundColumn)this.DataGrid1.Columns[1];
Response.Write(bc.DataField);

Share with

Share on twitter
Share on facebook
Share on linkedin