Print Page | Close Window

DevForceDataSource

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1039
Printed Date: 23-Apr-2024 at 7:58pm


Topic: DevForceDataSource
Posted By: orcities
Subject: DevForceDataSource
Date Posted: 30-Dec-2008 at 2:20pm
I am having an issue with the DevForceDataSource object when running the ExecuteSelect method.
 
I am mimicking the example:
-Create a dropdownlist for entities <Organization>
-Create DFDS to run GetAllEntities for <Organization>
 
Outcome: Runs successfully
 
-Create DetailsView
-Create DFDS to GetSelectedEntity using ControlParameter from the SelectedValue from the dropdownlist
 
Outcome: fails: Cannot cast Organization to IEnumerable
 
This does not make sense to me. ExecuteSelect for GetAllEntities is made of of a list of Organizations and passes. But, getting one Organization fails. List<Organization> is based off of Organization which is based from Entity which is based from DataRow. DataRow should be IEnumerable correct?
 
Please help. Been trying to track this down for a few days.



Replies:
Posted By: davidklitzke
Date Posted: 31-Dec-2008 at 8:35am
DevForceDataSource ia working as designed,  It expects a list of Entities, not a single Entity.  Therefore, you must return  a list containing a single Entity.  A single Orgnization is not the same as an EntityList<Organization> even when the EntityList contains a single  Organizatiion.


Posted By: orcities
Date Posted: 31-Dec-2008 at 9:22am
I did it exactly like the example. The example works and mine does not. The example has it return 1 record and it is successful.


Posted By: davidklitzke
Date Posted: 31-Dec-2008 at 2:13pm
Try doing a cast to IEnumerable before you return the result.  I know this should not be necessary, but I remember once doing it anyway, and it fixed my problem.



Print Page | Close Window