title: Why are alternating blank rows appearing in my GridView?
body: <p>All of this is fairly new to me, so I apologize if these are dumb questions. </p>
  
  <p>1 - The table that my GridView is pulling from contains no blank rows, so why is every other row in my GridView blank?  See my HTML and C# code below:</p>
  
  <p>2 - I can't seem to get the dates to format correctly.  Usually, I just insert DataFormatString: "{0:MM/dd/yyyy}" into each date row for the GridView.  That isn't working.  The dates are returning in a "YYYY-DD-MMT00:00:00-06:00" format.  I realize this has something to do with JSON, but how do I make the dates return in a "MM/DD/YYYY" format?  </p>
  
  <pre><code> &lt;script type="text/javascript" src="jquery-1.8.3.js"&gt;&lt;/script&gt;
      &lt;script src="ASPSnippets_Pager.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          $(function () {
              GetC(1);
          });
          $("[id*=txtC]").live("keyup", function () {
              GetC(parseInt(1));
          });
          $(".Pager .page").live("click", function () {
              GetC(parseInt($(this).attr('page')));
          });
          function SearchTerm() {
              return jQuery.trim($("[id*=txtC]").val());
          };
          function GetC(pageIndex) {
              $.ajax({
                  type: "POST",
                  url: "Default.aspx/GetC",
                  data: '{searchTerm: "' + SearchTerm() + '", pageIndex: ' + pageIndex + '}',
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: OnSuccess,
                  failure: function (response) {
                      alert(response.d);
                  },
                  error: function (response) {
                      alert(response.d);
                  }
              });
          }
          var row;
          function OnSuccess(response) {
              var xmlDoc = $.parseXML(response.d);
              var xml = $(xmlDoc);
              var c = xml.find("C");
              if (row == null) {
                  row = $("[id*=GridView1] tr:last-child").clone(true);
              }
              $("[id*=GridView1] tr").not($("[id*=GridView1] tr:first-child")).remove();
              if (c.length &gt; 0) {
                  $.each(company, function () {
                      var company = $(this);
                      $("td", row).eq(1).html($(this).find("A").text());
                      $("td", row).eq(2).html($(this).find("B").text());
                      $("td", row).eq(3).html($(this).find("C").text());
                      $("td", row).eq(4).html($(this).find("D").text());
                      $("td", row).eq(5).html($(this).find("E").text());
                      $("td", row).eq(6).html($(this).find("F").text());
                      $("td", row).eq(7).html($(this).find("G").text());
                      $("td", row).eq(8).html($(this).find("H").text());
                      $("td", row).eq(9).html($(this).find("I").text());
                      $("td", row).eq(10).html($(this).find("DateApproved").text());
                      $("td", row).eq(11).html($(this).find("J").text());
                      $("td", row).eq(12).html($(this).find("K").text());
                      $("td", row).eq(13).html($(this).find("L").text());
                      $("td", row).eq(14).html($(this).find("M").text());
                      $("[id*=GridView1]").append(row);
                      row = $("[id*=GridView1] tr:last-child").clone(true);
                  });
                  var pager = xml.find("Pager");
                  $(".Pager").ASPSnippets_Pager({
                      ActiveCssClass: "current",
                      PagerCssClass: "pager",
                      PageIndex: parseInt(pager.find("PageIndex").text()),
                      PageSize: parseInt(pager.find("PageSize").text()),
                      RecordCount: parseInt(pager.find("RecordCount").text())
                  });
                  $(".Company").each(function () {
                      var searchPattern = new RegExp('(' + SearchTerm() + ')', 'ig');
                      $(this).html($(this).text().replace(searchPattern, "&lt;span class = 'highlight'&gt;" + SearchTerm() + "&lt;/span&gt;"));
                  });
              } else {
                  var empty_row = row.clone(true);
                  $("td:first-child", empty_row).attr("colspan", $("td", row).length);
                  $("td:first-child", empty_row).attr("align", "center");
                  $("td:first-child", empty_row).html("No records found for the search criteria.");
                  $("td", empty_row).not($("td:first-child", empty_row)).remove();
                  $("[id*=GridView1]").append(empty_row);
              }
          };
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
          &lt;table style="font-family: 'Franklin Gothic Book'"&gt;
              &lt;tr&gt;
                  &lt;td colspan="2" style="background-color: #273B69; text-align: center" class="auto-style1"&gt;
                      &lt;h1 class="auto-style2"&gt;&lt;span class="auto-style3"&gt;&lt;/span&gt;
                      &lt;/h1&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td style="background-color: #D8D8D8;" class="auto-style8"&gt;
                      &lt;h3&gt;
  
                      &lt;/h3&gt;
                  &lt;/td&gt;
                  &lt;td style="vertical-align: top" class="auto-style7"&gt;
                      &lt;h5 class="auto-style6"&gt;
                          &lt;asp:GridView ID="GridView1" 
                              runat="server" 
                              AutoGenerateColumns="False" 
                              Font-Names="Franklin Gothic Book" 
                              Font-Size="Small" 
                              CellPadding="4" 
                              ForeColor="#333333" 
                              GridLines="Both" 
                              BorderWidth="1px" AutoGenerateSelectButton="True"&gt;
                              &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
                              &lt;Columns&gt;
                                  &lt;asp:BoundField DataField="A" HeaderText="A" /&gt;
                                  &lt;asp:BoundField DataField="B" HeaderText="B" /&gt;
                                  &lt;asp:BoundField DataField="C" HeaderText="C" /&gt;
                                  &lt;asp:BoundField DataField="D" HeaderText="D" /&gt;
                                  &lt;asp:BoundField DataField="E" HeaderText="E" /&gt;
                                  &lt;asp:BoundField DataField="F" HeaderText="F" /&gt;
                                  &lt;asp:BoundField DataField="G" HeaderText="G" /&gt;
                                  &lt;asp:BoundField DataField="H" HeaderText="H" /&gt;
                                  &lt;asp:BoundField DataField="I" HeaderText="I" /&gt;
                                  &lt;asp:BoundField DataField="J" HeaderText="J" /&gt;
                                  &lt;asp:BoundField DataField="K" HeaderText="K" /&gt;
                                  &lt;asp:BoundField DataField="L" HeaderText="L" /&gt;
                                  &lt;asp:BoundField DataField="M" HeaderText="M" /&gt;
                                  &lt;asp:BoundField DataField="N" HeaderText="N" Visible="false" /&gt;
                              &lt;/Columns&gt;
                              &lt;EditRowStyle BackColor="#999999" /&gt;
                              &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
                              &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
                              &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
                              &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
                              &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
                              &lt;SortedAscendingCellStyle BackColor="#E9E7E2" /&gt;
                              &lt;SortedAscendingHeaderStyle BackColor="#506C8C" /&gt;
                              &lt;SortedDescendingCellStyle BackColor="#FFFDF8" /&gt;
                              &lt;SortedDescendingHeaderStyle BackColor="#6F8DAE" /&gt;
                          &lt;/asp:GridView&gt;
  
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Web;
      using System.Web.UI;
      using System.Web.UI.WebControls;
      using System.Data;
      using System.Web.Services;
      using System.Configuration;
      using System.Data.SqlClient;
  
      public partial class _Default : System.Web.UI.Page
      {
          private static int PageSize = 10;
          protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              BindDummyRow();
          }
      }
  
      private void BindDummyRow()
      {
          DataTable dummy = new DataTable();
          dummy.Columns.Add("A");
          dummy.Columns.Add("B");
          dummy.Columns.Add("C");
          dummy.Columns.Add("D");
          dummy.Columns.Add("E");
          dummy.Columns.Add("F");
          dummy.Columns.Add("G");
          dummy.Columns.Add("H");
          dummy.Columns.Add("I");
          dummy.Columns.Add("J");
          dummy.Columns.Add("K");
          dummy.Columns.Add("L");
          dummy.Columns.Add("M");
          dummy.Columns.Add("N");
          dummy.Rows.Add();
          GridView1.DataSource = dummy;
          GridView1.DataBind();
      }
  
      [WebMethod]
      public static string GetC(string searchTerm, int pageIndex)
      {
          string query = "[GetC_Pager]";
          SqlCommand cmd = new SqlCommand(query);
          cmd.CommandType = CommandType.StoredProcedure;
          cmd.Parameters.AddWithValue("@SearchTerm", searchTerm);
          cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
          cmd.Parameters.AddWithValue("@PageSize", PageSize);
          cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
          return GetData(cmd, pageIndex).GetXml();
      }
  
      private static DataSet GetData(SqlCommand cmd, int pageIndex)
      {
          string strConnString = ConfigurationManager.ConnectionStrings["XYZConnectionString"].ConnectionString;
          using (SqlConnection con = new SqlConnection(strConnString))
          {
              using (SqlDataAdapter sda = new SqlDataAdapter())
              {
                  cmd.Connection = con;
                  sda.SelectCommand = cmd;
                  using (DataSet ds = new DataSet())
                  {
                      sda.Fill(ds, "C");
                      DataTable dt = new DataTable("Pager");
                      dt.Columns.Add("PageIndex");
                      dt.Columns.Add("PageSize");
                      dt.Columns.Add("RecordCount");
                      dt.Rows.Add();
                      dt.Rows[0]["PageIndex"] = pageIndex;
                      dt.Rows[0]["PageSize"] = PageSize;
                      dt.Rows[0]["RecordCount"] = cmd.Parameters["@RecordCount"].Value;
                      ds.Tables.Add(dt);
                      return ds;
                  }
              }
          }
      }
  }
  </code></pre>