title: Unable to cast object of type 'System.Web.UI.WebControls.EntityDataSourceWrapper' to type
body: <p>I use asp.net and c#.</p>
  
  <p>I have a DetailsView and I need get the data bound to it.</p>
  
  <p>I receive this error: Do you have an idea how to fix it?
  Thanks for your time.</p>
  
  <p>Please provide me a sample of code.</p>
  
  <pre><code>// Get the data for underlying DetailsView
  DetailsView myDetailsView = ((DetailsView)sender);
  WebProject.DataAccess.DatabaseModels.CmsContent rowView (WebProject.DataAccess.DatabaseModels.CmsContent)myDetailsView.DataItem;
  </code></pre>
  
  <hr>
  
  <pre><code>Unable to cast object of type 'System.Web.UI.WebControls.EntityDataSourceWrapper' to type 'WebProject.DataAccess.DatabaseModels.CmsContent'. 
  </code></pre>