Lookups with the same property

Jan 3, 2011 at 9:02 PM


I've a issue/question:

I've a table filled with rows of my model. In each row I have a Lookup for the same property(lookup).

For example:

<% foreach (var item in Model.Details) {%>
<%: Html.LookupFor(x => x.ConceptoID)%>

Is it possible? How can I make it works?

Thanks in advance.
Jan 4, 2011 at 7:17 AM

this way it is not going to work, because you're going to have a lot of elements with the same Id (invalid html), and it doesn't really makes sense to me, cuz you open the same lookup for the same property in each row,

I would like to know your reason for doing it this way ?

Jan 4, 2011 at 12:54 PM

I'm doing this for a Details view.

It's like a Order/OrderDetails in the northwind db. I have a header and details for the products. In that details, each row have a lookup for ProductId.

Jan 17, 2011 at 7:15 PM


in the new version I'm showing how to do list binding.

Look in the live demo

it's stuff like this:          @Html.LookupFor(o => o[i].Person, value:Model[i].Person)</div>

I think this could be what you need

and there's also prefixes