error using webService as datasource

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 05-Sep-2006 13:16:01   

version 1.0.2005.1 final (self-servicing) VS2005 asp.net 2.0


hiya,

I'm trying to bind a gridView to a webService that uses an entityCollection. I have checked and I know that the entityCollection contains several items.

Why therefore, do I get the following error when I try to databind the gridView with the entityCollection?

<error> System.Web.HttpException: The IListSource does not contain any data sources. </error>


[WebMethod()]
 public ContractCollection GetContracts()

{
        ContractCollection contracts = new ContractCollection ();
        contracts.GetMulti(null);

              return contracts;
}

...client code:

wsLocal.Service localService = new wsLocal.Service();
            
        GridView2.DataSource = localService .GetContractsPerClientLlblGen();         GridView2.DataBind();


many thanks,

yogi

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 05-Sep-2006 15:00:45   

What is the "GetContractsPerClientLlblGen()" method? It's not in the web service code you listed.

This error seems to indicate that your method didn't return anything. Have you tried stepping through your code with a debugger and examining what the service call returns?

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 05-Sep-2006 15:06:53   

apologies..

I was simplifying the code for the post and i made a typing mistake.

the call is "GetContracts" I have stepped thru it and the count is "9"

The isssue is why my gridView can't bind to a populated entityCollection that is returned from the webService method.

 [WebMethod()]
public ContractCollection GetContracts()

{
        ContractCollection contracts = new ContractCollection ();
        contracts.GetMulti(null);  //this is DEFINITELY populated

             return contracts;
}

...client code:

wsLocal.Service localService = new wsLocal.Service();
            
        GridView2.DataSource = localService .GetContracts();        
        GridView2.DataBind();

cheers,

yogi

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 05-Sep-2006 20:07:42   

Hi,

First I Ithink you should make it two statements so that we can clearly identify what relates to webservice, and what relates to databinding.

If you've got your entitycollection with 9 items after the call to the service, then it's fine with your web method, and you can search in the binding

Then two remarks:

Did you read the section from the manual about using webservices? There's quite a few things to setup before you get it properly.

Why not using the LLBLGendataSource(2) class between your collection and your gridview. It gives you more functionalities, and may help you get a more detailed exception if there's something wrong with your gridview.

Hope that helps

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 07-Sep-2006 23:50:09   

hiya,

ta for the advice.I'm going to upgrade to V2.I'm hoping it will be an easier rote to using llblgenPro for webservices.

yogi