I have successfully built a datatable and datagrid for a
user-selectable field interface. The user can select the fields they
want, and the controlling table has the data type information. I can
format the dates as I want by using the DataFormatString property of
the BoundColumn. That's because the grid sees the data as a date and
knows what to do with it. Now I want to format a phone number that was
stored as a string from 8005551212 as (800)555-1212 and I want to
format an ID number also stored as a string from 0987654321 to
09-87654-321. The biggest reason is to be able to export to MS Excel,
and if you have ever tried exporting data with leading zeros, and all
numbers, Excel is quite happy to convert it to a number, and drop the
leading zero. That, of course, after it converts it to scientific
notation!!!
I have found reference to templates, but no decent documentation that
shows how to dynamically create them, on the VB side.
Any examples out there?