Returning MenuItem object from a web service

C

Carl Ganz

I'm trying to build a MenuItem object in a web service and return it to
the proxy. Something like this:

[WebMethod]
public MenuItem GetReportMenu()
{
MenuItem oMenuItem = null;

oMenuItem = new MenuItem();
oMenuItem.Text = "Reports";

return oMenuItem;
}

This compiles fine but I get an error message when I update the web
reference in the proxy saying it cannot serialize. Is there any way to
accomplish this?

Thanks

Carl
 
S

sloan

You can try subclassing it, and making it serializable.

THe subclass doesn't do anything, except add the serializable tag.

c#


[Serializable]
public class MyMenuItem : MenuItem {
}

vb.net

<Serializable()> _

Public Class MyMenuItem: Inherits MenuItem

End Class


I have no idea if it'll work. I'm just throwing it out there.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top