Data Formatting in DataGrid Template Column
I have the following snippet of code is which I am trying to format a 10 digit phone number field for display in a datagrid, and it is not working. Any suggestions would be appreciated. (pardon the formatting). The format mask (itemTemplate) is not reflected in display for the datagrid info.
<asp:TemplateColumn SortExpression="u_phone" HeaderText="Phone">
<ItemTemplate>
<asp:Label id=Label8 runat="server" Width=80
Text='<%# Convert.ToString(DataBinder.Eval(Container, "DataItem.u_phone", "{0:(###)###-####}")) %>' / >
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id=etxtPhone runat="server" MaxLength=10 Width=80
Text='<%# DataBinder.Eval(Container, "DataItem.u_phone", "{0:##########}") %>' />
</asp:TemplateColumn>
|