473,396 Members | 1,864 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,396 software developers and data experts.

Passing an enum to a web method

Does anyone know how to pass an enum to a web method?

public enum RptSetStatus
{
PendingApproval,
Active,
}

[WebMethod]
public void SetRptSetLoadComplete(Guid oUserInstance, int nRptSetId,
RptSetStatus eRptSetStatus)
{

}

Tony
Apr 10 '06 #1
3 2230
"Tony" <to*****@spacecommand.net> wrote in message
news:e1**************@TK2MSFTNGP05.phx.gbl...
Does anyone know how to pass an enum to a web method?


Hi Tony,

if you are using .NET framework to call the web service, in the generated
proxy class on the client should be a method definition that would allow you
to pass the enum. Additionaly you can apply XmlEnumAttribute to your enum to
describe what value you want to serialize over the wire.

Regards,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MVP, MCT, MCSD.NET Early Achiever

Apr 10 '06 #2
Yes, the client is a v2.0 win forms client application.
I get compiler errors when attempting to use the enum - so if this is
possible, I must be doing something wrong..

Tony

"Martin Kulov [MVP]" <ku***@bezbokluk.abv.bg> wrote in message
news:OA**************@TK2MSFTNGP05.phx.gbl...
"Tony" <to*****@spacecommand.net> wrote in message
news:e1**************@TK2MSFTNGP05.phx.gbl...
Does anyone know how to pass an enum to a web method?


Hi Tony,

if you are using .NET framework to call the web service, in the generated
proxy class on the client should be a method definition that would allow
you to pass the enum. Additionaly you can apply XmlEnumAttribute to your
enum to describe what value you want to serialize over the wire.

Regards,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MVP, MCT, MCSD.NET Early Achiever

Apr 11 '06 #3
"Tony" <to*****@spacecommand.net> wrote in message
news:ek**************@TK2MSFTNGP03.phx.gbl...
Yes, the client is a v2.0 win forms client application.
I get compiler errors when attempting to use the enum - so if this is
possible, I must be doing something wrong..


Tony.

it would be helpful to see some sample code that is causing the error.

Martin

Apr 11 '06 #4

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

Similar topics

20
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum...
7
by: tony collier | last post by:
if i have a string eg string day="monday"; and an enumerator enum days {monday=0,tuesday, wednesday}
6
by: | last post by:
I have MyEnumeratedSet { ... some values go here ... } I have a variable that is defined as MyEnumeratedSet MyVariable; I have a function that needs to be able to set a variable by Ref...
16
by: Simon | last post by:
Hi all, I think I've seen someone passing an emumeration in code before. Can anyone tell me if thats possible and why i would want to. Many thanks Kindest Regards
1
by: Julia | last post by:
Hi, I am calling a remote object from ASP.NET application. when passing an ENUM to a method i am getting an exception "Server encountered an internal error. For more information, turn on...
7
by: chukkykzn | last post by:
Hi I'd like to pass an entire enumeration to a method. Not sure how it's done. Eg: enum MyEnum { one = 1, two = 2 } class Test
1
by: Powers | last post by:
I currently have a large number of enums implemented into my Web Service. I am reworking the XML serialization of these enums. At present, each enum has hardcoded values, for example: xAttrs...
5
by: Jay | last post by:
I want to be able to pass different enums into a method which makes use of the enum in some way. I've put together a simplified example below. How do I correctly pass an enum (eg Test1 or Test2 as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.