I use asp.net and c#.
I have a DetailsView and I need get the data bound to it.
I receive this error: Do you have an idea how to fix it?
Thanks for your time.
Please provide me a sample of code.
// Get the data for underlying DetailsView
DetailsView myDetailsView = ((DetailsView)sender);
WebProject.DataAccess.DatabaseModels.CmsContent rowView (WebProject.DataAccess.DatabaseModels.CmsContent)myDetailsView.DataItem;
Unable to cast object of type 'System.Web.UI.WebControls.EntityDataSourceWrapper' to type 'WebProject.DataAccess.DatabaseModels.CmsContent'.
To get object from DataItem you need to use approach described here: http://blogs.msdn.com/b/diego/archive/2008/05/13/entitydatasource-to-wrap-or-not-to-wrap.aspx
i.e. create class
And then call