Datagrid binding - custom formatting
Posted on 2005-04-14
I am binding a datagrid to a dataset. I want to be able to customize a format so that the data appears how I want it. For example, the raw data coming in from DB2 can be a 10 bytes long. In that case, I want to format it like a phone number. If it's longer than 10 bytes, I want to format it another way. So, in other words, I want to create my own formatting routines instead of using the default ones in .NET that I assign to the format property of my DataGridTextBoxColumn. See code below:
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.MappingName = "VPN";
DataGridTextBoxColumn column = new DataGridTextBoxColumn();
column.MappingName = "CU_ID_NO";
column.HeaderText = "Customer ID";
column.Width = 40;
column.Format = ?????
Is there a way to create a formatting routine so I can format my db2 data a certain way, other than the standard datetime, currency, etc formatting expressions that are built in???