简体   繁体   中英

how to get the web service response into grid view in C#

I am new to web services.

I want to display the response of web service into a GridView in my aspx file.

How is this possible?

Well, the first step would be to create a client proxy and invoke the service and the second step would be to point the DataSource property of the GridView to the collection you want to bind to. The final step is to call the DataBind method.

Example:

protected void Page_Load(object sender, EventArgs e)
{
    using (var proxy = new WebServiceClientProxy())
    {
        SomeModel[] data = proxy.GetData();
        gridView1.DataSource = data;
        gridView1.DataBind();
    }
}

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