How can I bind the results of Web service to a ListView?
I'm new to ASP.NET so I apologize if this is a basic question.
I have a Web application. This web application has a ListView on it. From this web app I make calls to a web service which returns data from a database. I return the data from the web service using the following format:
[WebMethod]
public List<Record> Search()
{
List<Record> list 开发者_开发技巧= new List<Record>();
/* Populate list with data from a db */
return list;
}
public class Record
{
public String name;
public String address;
public int ageInYears;
}
Now I would like from the Web Application to show the data on a listview. Is there a way of doing this by using the Data Source property of the Listview or the only way is to populate the listview manually?
Thanks a lot
Yes. use datasource, then try calling databind().
精彩评论