Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I need to display webservice results in table or grid format.

Please help me in this regard.

Thanks in advance.

Regards.
Kiran ganga
Posted
Updated 3-May-11 1:33am
v2
Comments
Sandeep Mewara 3-May-11 7:35am    
Any effort?

What is the problem you are facing. You can get data from your webservice and bind it some grid. or have some custom control to show it.
 
Share this answer
 
Working with the little information you've supplied, you can do the following:

1. Place a GridView control on the page, leave the ID as GridView1
2. Make sure the AutoGenerateColumns attribute is set to true
3. Assuming you're going to display the results when the page loads, do the following:

C#
protected void Page_Load(object sender, EventArgs e)
{
  if(!IsPostBack)
  {
  //webservice results implicitly loaded into variable as it's not part of the question how to get webservice   results
  var results;

    GridView1.DataSource = results;
    GridView1.DataBind();

 }
}
 
Share this answer
 
In a scenario where you are using wcf services asynchronously you will need to do something like this.

In you page declaration, in this example default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default"  Async="true"%>


Add a gridview with AutoGenerateColumns set to true.

Call the service. In this case Button1

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim t As New svrSearch.SearchVidsWithoutCategoryClient 
'service namespace and method. achieved when creating your reference 
       AddHandler t.SearchMoviesWithoutCategoryCompleted, AddressOf SearchMoviesWithoutCategoryCompletedEventArgs
       t.SearchMoviesWithoutCategoryAsync("Test Movie")
   End Sub


Render the results.
VB
Private Sub SearchMoviesWithoutCategoryCompletedEventArgs(ByVal sender As Object, ByVal e As SearchMoviesWithoutCategoryCompletedEventArgs)
       GridView1.DataSource = e.Result
       GridView1.DataBind()
   End Sub


If paging you may need to update the page index.

Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
      GridView1.PageIndex = e.NewPageIndex
  End Sub
 
Share this answer
 
v4
Try this,

1. You have to Add Web Reference into your project First.
2. Give a proper NameSpace to it.
3. Then create an object of your WebServices And Call a Method Which will give you Final result.
4. Load this Result into your Grid or Table Wherever you want.

I hope this will help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900