Sunday, 18 March 2012

How can we format data inside the DataGrid ?

We can use DataFormatString Property to format the data inside the DataGrid.
If the DataFormatString property is not set, the field's value is displayed without any special formatting.
Example:

<Columns>  
 <asp:BoundField HeaderText="Product ID" DataField="ProductID" />  
 <asp:BoundField HeaderText="UnitPrice" DataField="UnitPrice" 
   DataFormatString="{0:F0}" />  
</Columns>

No comments:

Post a Comment