Infragistics 10.2 .NET 3.5
I'm using a MaskEditorProvider for a bound column Phone number field within a webdatagrid.
It works when adding or editing, but does not when just displaying the phone number in the grid.
How do I display the phone number as (###) ###-####
The phone number field is coming from a sql db as a varchar data type.
Thanks for your help!
The phone number is now displaying correctly.
Hello Ron,
The editor providers formatting is applied only when the cells in the column are in edit mode. For the formatting of the column you should use DateFormatString property of the BoundDataField. Unfortunately DateFormatString doesn’t have formatting for telephone number. My suggestion is to make your custom implementation of the formatting. You can subscribe for InitializeRow event and format the cell text there. Something like:
protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
{
double number = Double.Parse(e.Row.Items[colIndex].Value.ToString());
string value = number.ToString("(###) ###-####");
e.Row.Items[colIndex].Text = value;
}
Hope this helps.
Regards,
Lyuba
Developer Support Engineer
Infragistics
www.infragistics.com/support