Reputation: 69
Possible duplicate Formatting DataBinder.Eval data
i want to change the format of an item template in a gridview, i want to show the currency..
this is my code:
<asp:TemplateField HeaderText="Monto">
<ItemTemplate><%# Eval("Monto")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtMonto" Text='<%# Eval("Monto", "{0:C2}")%>' /><%-- Eval("Price", "{0:C2}")--%>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtfooterMonto" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" id="rfvMonto" controltovalidate="txtfooterMonto" Display="None"
errormessage="Monto" ValidationGroup="InsertValidationControls"/>
</FooterTemplate>
</asp:TemplateField>
Upvotes: 0
Views: 8290
Reputation: 20620
You have formatting setup for editing here: EditItemTemplate
But not for viewing here: ItemTemplate
Upvotes: 1