asp.net - Exposing an Enum to a WebService's client JavaScript without using it in a WebMethod? -


I'm building an ASP.NET 3.5 application and an enum without using it to me in my WebService class Want to expose? Once in My webMethods as a parameter

I do what I want to describe a very simple example ... Let's say I have the following WebService (I Agent.asmx call it Do):

  & lt; System.Web.Script.Services.ScriptService () & gt; _ & Lt; System.Web.Services.WebService (namespace: = "http://tempuri.org/") & gt; _ & Lt; System.Web.Services.WebServiceBinding (conformsTo: = WsiProfiles.BasicProfile1_1) & gt; _ & Lt; Toolboxime (false) & gt; _ Public Class Agent Inheritance System. WebServices WebServices & lt; WebMethod (enabled session: = true) & gt; _ Public Function DoSomething (as ByVal doWhat WhatEnum) As Boolean Return ... End Function End Class Public Enum WhatEnum AskStackOverflowQuestion PhoneAFriend FiftyFifty end one of the Enum  

Because I webMethods Enum used, it generates for agent production following in JavaScript (from) when WebService referenced in my .aspx page:

  if (typeof (SomeNamespace.WhatEnum) == = "Undefined ') {Some namespace WHEnum = function () {error Error.invalidOperation ();} SomeNamespace.WhatEnum.prototype = {AskStackOverflowQuestion: 0, PhoneAFriend: 1, FiftyFifty: 2} SomeNamespace.WhatEnum.registerEnum ( 'SomeNamespace.WhatEnum', true);}  

Now I use these s -mon Now, it's all right and good, but I do not use my agent in any of the actual webMethods, which I also want to highlight in the agent's JavaScript There is another Enum in it. Is there a way, maybe one attribute or something I could use could be the reason for it?

If not, my fallback solution will be available only as a parameter with a dummy method with my anome, and can not just call it to JS, though I can not Did not want to waste Thanks!

think clearly would make the easiest solution dummy method I am that I think that Why do you need computation from your web service so that you get available in your JavaScript, if you will never pass that enumment with the service or receive it from the service in any way.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -