DataBinder Eval and Indexed properties

As you probably know you can “Eval” an array property like below:

<%# Eval("MyArray[0].Title") %>

But what if your data object has indexed property? how do “Eval” that?
Well it’s easier then you think it is:

<%# Eval("[0]") %>

And if your indexed property is based on for example a NameValueCollection you can “Eval” it like this:

<%# Eval("[key]") %>

As you see it’s very easy to “Eval” this kind of properties in you web application.

No Comments