|
|
|
Forum 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.
|
|
|
|
|
Forum 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
|
|
|
|
|
Forum 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.
|
|
|
|
|
Forum 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.
|
|
|
|
|
Forum 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???
|
|
|
|
|
Supreme 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]
|
|
|
|
|
Supreme 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
|
|
|
|
|
Supreme 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]
|
|