title: ASP.NET/C# Decimal to 0.00
body: <p>I got this method, how can I make the decimal to .00 and not .0000?</p>
  
  <pre><code>    public static List&lt;Product&gt; GetAllProducts()
  {
      List&lt;Product&gt; products = new List&lt;Product&gt;();
      string sqlQuery = "SELECT * FROM Products";
      using (SqlConnection connection = new SqlConnection(connectionString))
      {
          using (SqlCommand command = new SqlCommand(sqlQuery, connection))
          {
              connection.Open();
  
              using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
              {
                  while (reader.Read())
                  {
                      Product product = new Product();
                      product.Id = Convert.ToInt32(reader["Id"]);
                      product.ManufacturerId = Convert.ToInt32(reader["ManufacturerId"]);
                      product.CategoryId = Convert.ToInt32(reader["CategoryId"]);
                      product.Name = (reader["Name"]).ToString();
                      product.Description = (reader["Description"]).ToString();
                      product.Price = Convert.ToDecimal(reader["Price"]);
                      product.ItemsInStock = Convert.ToInt32(reader["ItemsInStock"]);
  
                      products.Add(product);
                  }
              }
          }
      }
      return products;
  }
  </code></pre>
  
  <p>UPDATE:
  Sorry for asking stupid questions.
  I can't see where to put the DataFormatString="{0:F2}"</p>
  
  <p>This is my grid:</p>
  
  <pre><code>            &lt;asp:TemplateField HeaderText="Price" SortExpression="Price"&gt;
                  &lt;EditItemTemplate&gt;
                      &lt;asp:TextBox ID="PriceTextBox" runat="server" Text='&lt;%# Bind("Price") %&gt;'&gt;&lt;/asp:TextBox&gt;
                  &lt;/EditItemTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="PriceLabel" runat="server" Text='&lt;%# Bind("Price") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  </code></pre>