protected void grvEmpresas_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e) { //******************* //* Formata telefone //******************* if (e.Column.FieldName == "cnpj_cpf") { if (e.Value.ToString().Length < 12) { System.ComponentModel.MaskedTextProvider oMask = new System.ComponentModel.MaskedTextProvider(@"000\.000\.000-00"); oMask.Set(e.Value.ToString()); e.DisplayText = oMask.ToString(); } else { System.ComponentModel.MaskedTextProvider oMask = new System.ComponentModel.MaskedTextProvider(@"00\.000\.000-0000-00"); oMask.Set(e.Value.ToString()); e.DisplayText = oMask.ToString(); } } if (e.Column.FieldName == "contato_fone_fixo" || e.Column.FieldName == "contato_fone_celular") { System.ComponentModel.MaskedTextProvider oMask = new System.ComponentModel.MaskedTextProvider("(00) 000-000-000"); oMask.Set(e.Value.ToString()); e.DisplayText = oMask.ToString(); } }
protected void grvAdministradores_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e) { //******************* //* Formata telefone //******************* if (e.Column.FieldName != "telefone") { return; } System.ComponentModel.MaskedTextProvider oMask = new System.ComponentModel.MaskedTextProvider("(00) 000-000-000"); oMask.Set(e.Value.ToString()); e.DisplayText = oMask.ToString(); }