Reputation: 85
i have class bound to repeater as a list here is structure of class
public String Name { get; set; }
public String Description { get; set; }
public List<ProductRecord> ProductList { get; set; }
i can get Eval("Name") on aspx page. How do i go about accessing ProductList properties in Eval e.g ProductRecord has Name property
Thank you in advance
Upvotes: 1
Views: 558
Reputation: 352
You need to tell the Eval which one of the multiple ProductRecord you want. The problem is that you want to navigate a 1 to many relationship and get a value from the many. You have to make it a 1 to 1 relationship. For this you could either specify a single element like:
Eval("ProductList[0].Name")
Another option would be to put ProductList on a new Repeater, so you can show all the ProductList's properties for your structure. Or concatenating all values into a single value for display.
Upvotes: 2