title: Error accessing Object Property "A field or property with the name {PROPERTY_NAME} was not found on the selected data source"
body: <p>Having trouble with some code when moving it to a server. The code runs fine on my local machine. I have no problem accessing this property on my local machine. But, when I Upload it to my development server, I get this error:</p>
  
  <blockquote>
    <p>A field or property with the name 'CreatedBy.FullName' was not found on the selected data source.</p>
    
    <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.</p>
    
    <p>Exception Details: System.Web.HttpException: A field or property with the name 'CreatedBy.FullName' was not found on the selected data source.
    Source Error:</p>
    
    <p>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</p>
    
    <p>Stack Trace:</p>
    
    <p>[HttpException (0x80004005): A field or property with the name 'CreatedBy.FullName' was not found on the selected data source.]
           System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer) +1788095
           System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e) +67
           System.Web.UI.Control.OnDataBinding(EventArgs e) +91
           System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
           System.Web.UI.Control.DataBind() +15
           System.Web.UI.Control.DataBindChildren() +201
           System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
           System.Web.UI.Control.DataBind() +15
           System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +166
           System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3098
           System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
           System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
           System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
           System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
           System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
           System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
           System.Web.UI.WebControls.GridView.DataBind() +4
           System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
           System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
           System.Web.UI.Control.EnsureChildControls() +102
           System.Web.UI.Control.PreRenderRecursiveInternal() +42
           System.Web.UI.Control.PreRenderRecursiveInternal() +175
           System.Web.UI.Control.PreRenderRecursiveInternal() +175
           System.Web.UI.Control.PreRenderRecursiveInternal() +175
           System.Web.UI.Control.PreRenderRecursiveInternal() +175
           System.Web.UI.Control.PreRenderRecursiveInternal() +175
           System.Web.UI.Control.PreRenderRecursiveInternal() +175
           System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496</p>
  </blockquote>
  
  <p>Here is what the aspx page looks like (snip):</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" DataKeyNames="ApplicationID" CellPadding="4" ForeColor="#333333" GridLines="None"&gt;
          &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
          &lt;Columns&gt;
              &lt;asp:CommandField ShowEditButton="True" ShowDeleteButton="True" /&gt;
              &lt;asp:HyperLinkField DataNavigateUrlFields="applicationID" DataNavigateUrlFormatString="~/Admin/ManageRoles.aspx?applicationID={0}" Text="View App Roles" /&gt;
              &lt;asp:HyperLinkField DataNavigateUrlFields="applicationID" DataNavigateUrlFormatString="~/Admin/ManageApplicationUsers.aspx?applicationID={0}" Text="View App Users" /&gt;
              &lt;asp:BoundField DataField="ApplicationID" HeaderText="ApplicationID" ReadOnly="True" SortExpression="ApplicationID" /&gt;
              &lt;asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /&gt;
              &lt;asp:TemplateField HeaderText="Description" SortExpression="Description"&gt;
                  &lt;EditItemTemplate&gt;
                      &lt;asp:TextBox ID="TextBox1" runat="server" Text='&lt;%# Bind("Description") %&gt;' TextMode="MultiLine"&gt;&lt;/asp:TextBox&gt;
                  &lt;/EditItemTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("Description") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
              &lt;asp:BoundField DataField="CreatedBy.FullName" HeaderText="Created By" SortExpression="CreatedByID" ReadOnly="True" /&gt;
              &lt;asp:BoundField DataField="CreatedDate" HeaderText="CreatedDate" ReadOnly="True" SortExpression="CreatedDate" /&gt;
              &lt;asp:BoundField DataField="ModifiedBy.FullName" HeaderText="Modified By" SortExpression="ModifiedByID" NullDisplayText="&amp;lt;i&amp;gt;null&amp;lt;/i&amp;gt;" ReadOnly="True" /&gt;
              &lt;asp:BoundField DataField="ModifiedDate" HeaderText="ModifiedDate" ReadOnly="True" SortExpression="ModifiedDate" NullDisplayText="&amp;lt;i&amp;gt;null&amp;lt;/i&amp;gt;" /&gt;
          &lt;/Columns&gt;
  &lt;!-- SNIP: styling --&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>UPDATE</strong>
  I've got my code to run by using a workaround. If I use a template field instead of bound field, it will run. for example, I use this:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Description" SortExpression="Description"&gt;
                  &lt;EditItemTemplate&gt;
                      &lt;asp:TextBox ID="TextBox1" runat="server" Text='&lt;%# Bind("CreatedBy.FullName") %&gt;' TextMode="MultiLine"&gt;&lt;/asp:TextBox&gt;
                  &lt;/EditItemTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("CreatedBy.FullName") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>instead of this:</p>
  
  <pre><code>&lt;asp:BoundField DataField="CreatedBy.FullName" HeaderText="Created By" SortExpression="CreatedByID" ReadOnly="True" /&gt;
  </code></pre>
  
  <p>I'm glad it's working now, but frankly, I'd like to know what the problem was too!</p>