When I loop through my data in c# I have to use the below to get the value:
foreach (var item in documentQuery)
{
string value = item.getproperty("title");
//value = "hello world"
}
But if I want to bind the results to an asp:repeater in an ASPX page how would I call this same getproperty method in the ItemTemplate? Because if I just go <%# Eval("title") %> it gives an error...
Eval()
is a shortcut to simplify binding. To do something more complex, you won't be able to use it.
I think you need to do something like:
<%# Container.DataItem.getproperty("title")) %>
Or you might have to cast Container.DataItem to your specific type of item:
<%# (Container.DataItem as XXXXXXX).getproperty("title")) %>
where XXXXXXX
is whatever the type your item is.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.