title: Formatting Gridview display in ASPX page
body: <p><img src="https://i.stack.imgur.com/zlk07.jpg" alt="enter image description here">Scenario : I have an ASPX page with Gridview. Every row has one column heading and it's value. At the end of record there is a generic line.</p>
  
  <p>My issue is with formatting and CSS.</p>
  
  <p>I would like the output to be as below (I have tried to format but upon posting it is loosing)</p>
  
  <hr>
  
  <h2>|  Customer Name   | Microsoft  |</h2>
  
  <h2>|  Customer City   |  Seattle   |</h2>
  
  <h2>|                               |</h2>
  
  <h2>|  Customer Name   | DowJones   |</h2>
  
  <h2>|  Customer City   |     NYC    |</h2>
  
  <p>Above the customer name is centered to that cell. Similarly it's value also (Microsoft). Also CustomerName is colored with darkblack and "Microsoft" with just black.</p>
  
  <p>The '-----' and "|" are actually table borders/seperators. It is typical table with borders and horizontal line and vertical line.</p>
  
  <p>Please suggest. Below is my code.</p>
  
  <pre><code>        &lt;div style="width:400px; font-family:Arial; font-size:small"&gt;
        &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
          Width="100%" GridLines= "Horizontal"&gt;
          &lt;Columns&gt;
            &lt;asp:TemplateField&gt;
            &lt;ItemTemplate&gt; 
  
  
              &lt;div style="color:Blue;font-weight:bold"&gt;
              &lt;br /&gt;
              &lt;tr&gt;
                &lt;td&gt;&lt;asp:Label ID="Label5" runat="server" Text='Customer NAME' cssclass ="blackboldhdr" &gt;&lt;/asp:Label&gt;&lt;/td&gt;
                &lt;td&gt;&lt;asp:Label ID="Label1" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem,"DealerName") %&gt;' cssclass ="blackboldtxt"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td&gt;&lt;asp:Label ID="Label2" runat="server" Text='Customer City'&gt;&lt;/asp:Label&gt;&lt;/td&gt;
                &lt;td&gt;&lt;asp:Label ID="Label3" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem,"City") %&gt;'&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
            &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
      &lt;/div&gt;    
  
              &lt;style&gt; 
      .blackboldtxt {
          font-family: Arial, Helvetica, sans-serif;
          font-size: 12px;
          color:black;
          font-weight: bold;
  
      }
      .blackboldhdr
      {
          font-family: Arial, Helvetica, sans-serif;
          font-size: 12px;
          /*color:#FFFFFF;*/
          background-color: #2A3C54;
          width: 152px; 
          text-align:center;
      }
  &lt;/style&gt; 
  </code></pre>