Hi Steve,
The array of items is probably setting up the item class to have fields
exposed directly instead of properties (which the form binding requires).
To fix this, you need to make the proxy use a class that exposes the data
via properties instead of by field. You can only do this by manually
changing the generated proxy.
For an example of what the item class needs to look like, run the schema
for your service interface thru the XsdObjectGen.exe tool that you can
download from microsoft.com downloads. This will show you the kind of
markup required. If you want to, you can just comment out the lines in the
generated proxy that define the data interface for your service, add a
reference to the assembly created by XsdObjectGen to the project, add a
Using/Imports statement at the top of the proxy code file, and compile.
This should do the trick.
Hope this helps
Dan Rogers
Microsoft Corporation
--------------------
From: "Steve Lutz" <sl***@nospam.comcast.net>
Subject: Interesting Problem With WebService results and Repeater Control
Date: Sat, 4 Dec 2004 08:35:03 -0500
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.181
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181
Message-ID: <##**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: nat153.infonautics.com 208.37.113.153
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXS01.phx.gbl!cpmsftn gxa06.phx.gbl!TK2MSFTNGP08
.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7853
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
I have written a web service to provide some back-end functionality to a Web
Site. The web service returns lists of items.
If I use the webservice via a browser, it works fine and returns the results
in XML.
I then created the proxy for the Web Service in VS.NET. I can call the
webmethod fine and get an array of Items. (Although it's a local class to
the WebSite).
When I attempt to have a repeater control list the reults in a web form, I
get an error that the class Item does not contain a property called "Name".
I'm not sure where to go from here aside from attempting to convert the Item
array into something else manually.
---------
Quick Code Example
[Web Method]
public Item[] GetItems(string CategoryID)
{
return ItemList(CategoryID); // Helper function that constructs
the array
}
Class Item
{
private string _name;
Public Name
{
Get { return _name;};
Set { _name = value}
}
}