>If it's bound to something like a datatable, code like this should work:
>
>
>if (e.Row.DataItem is DataRowView)
>{
> DataRowView view = e.Row.DataItem as DataRowView;
> string field = view["FieldInTable"].ToString();
>}
>
>
>Basically you cast DataItem to the correct underlying type, then reference the elements the standard way for that type.
In my case it's bound to an object. Somehow this code doesn't work for me. I can go back with Cells approach, but I really like this syntax better.
If it's not broken, fix it until it is.
My Blog