Return listview item from webservices

A

apondu

Hi,

This is Govadhan, i am a begginer for web services using c#.net. I
have written a small web service where in i have created a listview
item in the web service method and added some data to the listview
item. Now i have problem. I want this listview to be passed as a
return value to the calling program. can some one help me with how to
achieve this.

I want to return the listview item, can anyone say me is it possible
to convert this listview item to a object type and thn return it. If
this can be done can anyone provide me with the information on how to
achieve this.

Thanks for the help.

This is my email-id : (e-mail address removed)

Regards,
Govardhan
 
N

Nicholas Paldino [.NET/C# MVP]

Govardhan,

You can't have the signature of the web service method be "object". If
you do, then none of the information about the specific type is going to be
persisted over the wire.

Also, I wouldn't recommend sending a ListViewItem over the wire either.
It suggests a very tight coupling with the UI implementation which kind of
smacks of bad design.

On top of that, the ListViewItem exposes the ListView property. The
ListView is a control that has an affinity to the thread that created it.
Certainly, the thread that is calling the web service doesn't share that
affinity.

What I would recommend doing is creating a simple type of your own which
has the information you need in the ListViewItem and returning that. Then,
on the caller side, you would create the ListViewItem and then populate it.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top