开发者

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.

开发者_如何学JAVA

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();
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜