DataBinder Eval and Indexed properties

Posted by erwin21 on ASP.net Weblogs See other posts from ASP.net Weblogs or by erwin21
Published on Wed, 24 Mar 2010 09:15:15 GMT Indexed on 2010/03/24 9:23 UTC
Read the original article Hit count: 456

Filed under:
|
|

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.

© ASP.net Weblogs or respective owner

Related posts about .NET

Related posts about ASP.NET