Get Itens from an EcoDataSource
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Get Itens from an EcoDataSource Expand / Collapse
Author
Message
Posted 2008-10-14 22:02:07
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2008-10-29 15:12:25
Posts: 3, Visits: 30
Hello.

I would like to get an item from my data source. This is the DataSource of my DropDownList. So I can select an item from it. Through the selectedIndex of my dropdownlist, I'd like to index my DataSource. I used ECO3, and there I could do this using an Expression Handle. Is there any way to do this in ECO 4???

Thanks by Now.
Post #587
Posted 2008-10-15 12:43:12
Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru

Group: Forum Members
Last Login: 2010-08-12 17:32:24
Posts: 51, Visits: 600
Hi Jose

I take it this is using ASP.Net

You should set the vaue property of your dropdown list to the ExternalId column in the datasource

You can then use this ExternalId to load the object selected and do whatever you need to do

Regrads

Nick

Post #589
Posted 2008-10-15 21:17:17
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2008-10-29 15:12:25
Posts: 3, Visits: 30
But this way I can't keep with other itens.

I'm adding a new object on my database and this object of this class has an association with another class. On my dropdownlist I have all objects of this other class, which was loaded by this EcoDataSource. I know the index of this item. I'd like only to index the EcoDataSource of this item. I asked Jonas and he also doesn't know.
I'd like to do the same I used to do in Eco 3, that I could get my ElementHandle as a Collection.
Post #590
Posted 2008-10-15 22:21:45
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 2009-12-11 17:29:47
Posts: 27, Visits: 281
Hi Jose.

The ASP.net 2 databinging useing the datasoruces is quite different from the ASP.Net 1 databinding.

You need to do it the way Nick suggests.

The Datasource doesn't actually have a list, it can just supply one o any contorl that asks for ome.

The way you used in ECO III is actually both fairly inefficent, and unsafe. One thig you should be aware of is that in ASP.NET, the page is recreated for each postback, so with the way yout used before the havedel will be reevaluation for each postback. This is boht ineffiecing, and unsafe in the case where some other has modified the database after the display of the page, but before the postback. In that case the same position on the handle may contain something else.

The way Nick suggests, only the objecgt you need will be fetched on postback.

Post #591
Posted 2008-10-16 15:23:33
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2008-10-29 15:12:25
Posts: 3, Visits: 30
I did this:

Eco.Services.IExternalIdService externalIdService =
EcoSpaceManager1.EcoSpace.GetEcoService();
disciplina.cl_controlador =
externalIdService.ObjectForId(ddlControladores.SelectedValue).GetValue < cl_controlador > ();

Was it that you was trying to say or to add the SelectedValue of dropdownlist as a parameter in EcoDataSource?

I also tried to use EcoDataSourceView, but I don't know how to use it correctly and it didn't work. Should I use an IOclService to do this select using allLoadedObjects???
Post #592
Posted 2008-10-16 22:08:59
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230, Visits: 1 382
assuming that diciplina.cl_controlador is a reference to an object of type Controlador in your model, you pwobably want:

disciplina.cl_controlador = externalIdService.ObjectForId(ddlControladores.SelectedValue).AsObject as Controlador;

/Jonas




/Jonas Hogstrom [CapableObjects]
Post #594
Posted 2008-10-17 14:23:00
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-07-14 17:05:00
Posts: 290, Visits: 2 617
Jonas Hogstrom (2008-10-16)
assuming that diciplina.cl_controlador is a reference to an object of type Controlador in your model, you pwobably want:

disciplina.cl_controlador = externalIdService.ObjectForId(ddlControladores.SelectedValue).AsObject as Controlador;

/Jonas




or use the new optional syntax

disciplina.cl_controlador = externalIdService.ObjectForId(ddlControladores.SelectedValue).GetValue < Controlador > ();


====
Pete
Post #595
Posted 2008-10-17 14:24:47
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230, Visits: 1 382
I think the forum software is stripping out the angle brackets... lets try:
here follows angle brackets... < text inside angle brackets >

Update: Angle brackets are removed if they are not surrounded by space. I have updated the previous posts in this thread to show the brackets correctly. now the conversation makes a little more sense :-)


/Jonas Hogstrom [CapableObjects]
Post #596
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 12:28

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,250. 9 queries. Compression Disabled.