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

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.