Working with Access Databases in Microsoft Expression WebFormatting number fields in an ASP.NET GridViewFormat a field as CurrencyCommon GridView Tasks > Edit Columns Select the fields from the Selected fields list Under BoundField > Behavior properties, set HtmlEncode to False Under BoundField > Data Properties, setDataFormatString to {0:C2} (The C means Currency, the 2 represents the number of positions after the decimal point.) And click OK This is what the code looks like: <asp:boundfield HtmlEncode="False" DataFormatString="{0:C2}" DataField="salary" SortExpression="salary" HeaderText="salary"> </asp:boundfield> Format a field as a PercentThe field in the Access database was defined as: Field Size: Single, Format: Percent, and Decimals Places: Auto. Common GridView Tasks > Edit Columns Select the fields from the Selected fields list Under BoundField > Behavior properties, set HtmlEncode to False Under BoundField > Data Properties, setDataFormatString to {0:P2} (The P means Percent, the 2 represents the number of positions after the decimal point.) And click OK This is what the code looks like: <asp:boundfield HtmlEncode="False" DataFormatString="{0:P2}" DataField="amount" SortExpression="amount" HeaderText="amount"> </asp:boundfield>
Back to Working with Access Databases in Microsoft Expression Web |