开发者

How can I bind the results of Web service to a ListView?

开发者 https://www.devze.com 2023-01-06 17:57 出处:网络
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.

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().

0

精彩评论

暂无评论...
验证码 换一张
取 消