views:

282

answers:

1

Until now, I've always explicitly formatted every column in my GridView.

But now, my datasource can vary in number of columns, so I autogenerate="true"

That leaves me with no place to define the format, so all the non-string fields have four decimal places when I want two-decimal accounting format.

A: 

You can use the GridView.RowDatabound event to access the values in each row. Here's an article covering it. Optionally, you can access the GridView.Databound event and iterate over the rows yourself.

Jeremy