Wednesday, July 2, 2008

Access any table field in RowDataBound

Make sure you're in a DataRow, we don't want to do this when in a header, footer, or paging row, then give the table's field name you're looking for:

Dim FieldValue As String = ""
If e.Row.RowType = DataControlRowType.DataRow Then
    FieldValue = DataBinder.Eval(e.Row.DataItem, "fieldname")
End If

No comments: