title: How to bind a class object into grid view through a different class object?
body: <p>I have 2 classes:</p>
  
  <pre><code>public class clsShipper 
  {
      public string ShipperName { get; set; }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class clsJobInfo 
  {
      public long JobID { get; set; }
  
      public clsShipper oShipper = new clsShipper();
  }
  </code></pre>
  
  <p>My GridView is as follows</p>
  
  <pre><code>&lt;asp:GridView ID="dgvJobCostList" runat="server" CellPadding="4" ForeColor="#333333" style="font-family:Verdana;font-size:10px;" AutoGenerateColumns="False" OnSelectedIndexChanged="dgvJobCostList_SelectedIndexChanged"&gt;
      &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
      &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
      &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
      &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
      &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
      &lt;EditRowStyle BackColor="#999999" /&gt;
      &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:CheckBox ID="chkRowCheck" runat="server" /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="ID"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="lblJobID" runat="server" Text='&lt;%# Bind("JobID") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Shipper"&gt;
              &lt;ItemTemplate&gt;
              &lt;asp:Label ID="lblShipperName" runat="server" Text='&lt;%# Bind("ShipperName") %&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;  
  </code></pre>
  
  <p>I am trying to bind the ShipperName property of Shipper Class through the JobInfo Class object. I tried below</p>
  
  <pre><code>protected void btnSearch_Click(object sender, EventArgs e)
  {
      if (oOutputJobInfo.Length &lt; 1)
      {
          lblMessage.Text = "Error : No Data Found";
          lblMessage.Visible = true;
          return;
      }
      else
      {
          dgvJobCostList.DataSource = oOutputJobInfo;
          dgvJobCostList.DataBind();
          dgvJobCostList.Visible = true;
      }
  }
  </code></pre>
  
  <p>But gives below error</p>
  
  <blockquote>
    <p>DataBinding: 'Nucleus.BOL.clsJobInfo' does not contain a property with the name 'ShipperName'.</p>
  </blockquote>