I haven't really tried passing a variable to a
DataFormatString
, and I'm not sure if that is going to work. You may want to handle the formatting at your code behind page instead. For example, you can do something like this at
DataBound
event of
GridView
:
((BoundField)GridView1.Columns[ColumnIndex]).DataFormatString = YourCustomFormatStringVariable;