473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Interesting Problem With WebService results and Repeater Control

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}
}

}


Nov 23 '05 #1
1 1788
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}
}

}



Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dan Nash | last post by:
Hi guys I've just setup my repeater to work with the PagedDataSet class as per the article on 4guysfromrolla. I got everything working great.. it displayed the first 20 results, and a next...
1
by: louis_la_brocante | last post by:
Dear all, I am having trouble generating a client proxy for a webservice whose methods return a "complex" type. The type is complex in that it is a class whose members are a mix of primitive...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
1
by: jazzart | last post by:
Hi there, I'm fairly new to programming with Asp.Net 2.0 so I'm finding myself regularly fumbling around in the dark a bit, so to speak. I'm currently using Visual Web Developer and have been...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.