Questions tagged [webmethod]

WebMethod is an attribute that is marked to indicate that a function (usually in .NET) in a web service is exposed to the consumers of the web service.

The WebMethod attribute is attached to a public method (cannot be attached to a private/protected) that you want the method exposed as part of the .NET Web service. It is also used to further configure the behavior of the method by passing additional attributes. Check out the MSDN link for more information, How to: Use the WebMethod Attribute.

1317 questions
-1
votes
1 answer

Are parameters of generic type or type object, thread safe?

[Webmethod] Public static string GetAge(List input1, string input2) { Cust cu=Cust.CalAge(input1,input2) cu.agemodify=true; } An AJAX call calls this Webservice. CalAge is a static method inside class…
Nothing
  • 99
  • 12
-1
votes
1 answer

Access WebMethod in external C# class on AJAX call

I would like to know what url should we use on AJAX to call a WebMethod in an external C# class To call a [WebMethod] on a page's code behind by AJAX we use: url: 'default.aspx/Method' But i am being unable to access a [WebMethod] in MyClass.cs…
Tiago
  • 365
  • 1
  • 4
  • 17
-1
votes
1 answer

How to send a list of class from client into webmethod with ajax

I have a list of class that made in client with typescript, Now i want to send it to webmethod. My typescript code is below : class MakeReportData { LocalName: string; FldSi: number; ViewSi:number; TypeName:string ; …
Hootan.Ghiasi
  • 99
  • 2
  • 9
-1
votes
2 answers

Call C# method from JavaScript and return JSON

I am trying to make JavaScript work with C#. For now, i am just trying to retrieve (GET) a return result from the C# and display it via JavaScript. Later, it will be for database writing (POST). Like so, and after reading, here's where i got…
Mr Billy
  • 151
  • 1
  • 2
  • 13
-1
votes
1 answer

Return newtonsoft json object from WebMethod

I want to return a JSON object from a c# webmethod if i use return i have an error "recussive reference found". So i decided to use newtonsoft serialize but the returned object are in double quote. {d:"my json"} and didn't work. I try to use this…
JD11
  • 306
  • 3
  • 11
-1
votes
1 answer

Passing complex JSON to a WebMethod

I'm trying to pass an JSON that has the following structure: {"var":"{"var1:"val1","var2:"val2",...,"varN:"valN"}"} My JS function executing the following POST function: $.ajax({ type: "POST", url: "MyWebApp.aspx/Foo", data: …
altgov3en
  • 1,100
  • 2
  • 18
  • 33
-1
votes
1 answer

How to check multi check boxes on the basis of database column in Jquery?

I have one asp.net data table control. in every tag I have images with checkboxes. $("#gvDetails").empty(); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "gallries.aspx/BindDatatable", …
asma
  • 75
  • 9
-1
votes
1 answer

How to arrange six columns in rows as per images?

I treid to arrange images in six columns like but its repeating the images $(document).ready(function () { alert('Hello'); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", …
Azaad
  • 5
  • 7
-1
votes
1 answer

consume a web service from a c++ windows service application

I am trying to consume a c# web service in a c++ windows service application. I first wrote a c++ VCL forms app and consumed the web service using WSDL importer. This worked perfectly and gave me access to all the web methods. Then I wrote the c++…
Mica
  • 1
  • 2
-1
votes
1 answer

ASP.NET Updating a list using jQuery AJAX

I'm displaying a list on the Default.aspx page that contains objects (persons) fetched from the database: [WebMethod] [ScriptMethod(UseHttpGet = false)] public static void getPersonList() { DatabankService dbs = new DatabankService(); …
Sam
  • 1,303
  • 3
  • 23
  • 41
-1
votes
2 answers

static void c# webmethod can't reference user control?

I have a WebMethod where I just want to flip a property to true. I am putting it in the code-behind of a .aspx page using C#. public partial class Data : Base { protected void Page_Load(object sender, EventArgs e) { …
JoJo
  • 4,643
  • 9
  • 42
  • 65
-1
votes
2 answers

If statement doesn't seem to work in a stringbuilder (WebMethod)

I have the following WebMethod that returns a conditional string. Unfortunately the if statement doesn't seem to work. I know that the WebMethod is working because I get the Bla bla bla string but not the icons within the if statement. What am I…
Gloria
  • 1,305
  • 5
  • 22
  • 57
-1
votes
2 answers

Checking if email already exist or not using javascript and Asp.net method

I am checking that if email exist or not using javascript , But it is firing "Email already exist" every time even if email does not already exist. Code is given below : Javascript code : function chkemailExist(source, args) { var exists; …
rahul bhatt
  • 362
  • 1
  • 3
  • 14
-1
votes
1 answer

Ajax calling WebMethod nothing happens

Why oh why doesn't this code do Anything?! What is wrong with my ajax? My ajax: $.ajax({ type: "POST", url: "/index.aspx/Uppdatera", data: "{ Id:"+ JSON.stringify($item.Id) +" }", …
user3581054
  • 125
  • 12
-1
votes
2 answers

Response.Redirect in a Webmethod

I am trying to use the response.redirect command in call webmethod and it does not work, see how is my code: HTML: Próxima Aula -> JS: function proximaAula() { var tipo = getParameterByName('t'); if (tipo ==…
ISFO
  • 135
  • 2
  • 9