简体   繁体   中英

Display List values using repeater control asp.net

I've added the content from DirectoryInfo.GetFiles() to a List<string> . Now I wish to display each row from the list using the Repeater control. I've done this before with the <%# Eval("Name") %> when I got the data directly from DirectoryInfo.GetFiles() .

But now when they're in a list, the "Name" attribute does not seem to be there anymore. So how should I do this with the Eval..?

Now the Data is the string itself. Get it using this code.

<%#GetNane(Container.DataItem)%>

and on code behind

public string GetNane(object oItem)
{
  return (string)oItem;
}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM