title: format decimal value in gridview
body: <p>I have a bound field in my Gridview which is getting its value from a database table.</p>
  
  <p>I have got the data but don't know how to format it inside the gridview.</p>
  
  <p>For example I get total data from below like "123456", but I want to display as "123,456"</p>
  
  <pre><code>  &lt;asp:BoundField DataField="totaldata" HeaderText="Total Data"  
         ReadOnly="True" SortExpression="totaldata" /&gt;
  </code></pre>
  
  <p>How can I do this? Do I need to convert the bound field into a template field ? But what do i do after that.</p>
  
  <p>please help.</p>
  
  <p>I have used DataFormatString="{0:n0}" and it solved the above problem.</p>
  
  <p>how do i do for this:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Failed Files" 
              SortExpression="NumFailed"&gt;
              &lt;ItemTemplate&gt;
               &lt;asp:Image ID="Image2" runat="server" ImageUrl="~/NewFolder1/warning_16x16.gif" /&gt;
                  &lt;asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='&lt;%# "GetFilesFailed.aspx?id="+Eval("MachineID") %&gt;' Text='&lt;%# Bind("NumFailedFiles") %&gt;'&gt;&lt;/asp:HyperLink&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>the hyperlink has the number which need to be formatted...</p>