Returning MenuItem object from a web service

  • Thread starter Thread starter Carl Ganz
  • Start date Start date
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
 
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

Back
Top