webmethod

WebMethod not called (triggered) by PageMethod in Visual Studio 2013

主宰稳场 提交于 2019-11-28 08:21:08
问题 I have the following problem: The call from a WebMethod is not being done on a project created in Visual Studio 2013 (ASP.NET WebForms Application). If I create a project, for example, in Visual Studio 2008 and migrate to VS 2013 works correctly. The problem only occurs when I create a new project in Visual Studio 2013. There is no error message in the console. The WebMethod is just not being called. Nothing happens. I searched a lot but found nothing about it. ASPX code: <%@ Page Language=

jquery ajax 200 OK JSON.ParseError

[亡魂溺海] 提交于 2019-11-28 08:11:12
问题 I have a control which has a textbox which, when its content changes, will tricker this javascript function: page parameter is document.URL as the control has no attached .asxc page and fieldValue is value of the textbox. function UpdateFieldsOnListSelection(page, fieldValue) { $.ajax({ type: "POST", url: page + "/IsSelectedListPictureLibrary", data: { "libraryInfo": fieldValue }, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { alert("Success!"); }

Call ASP.NET web service method from JavaScript

房东的猫 提交于 2019-11-28 06:19:41
问题 I have the web service: [WebMethod] public void SendMail(string _name, string _email, string _message) { //Create Mail Message Object with content that you want to send with mail. MailMessage MyMailMessage = new MailMessage("gglebati@example.com", "gglebati@example.com", "This is the mail subject", "Just wanted to say Hello"); MyMailMessage.IsBodyHtml = false; //Proper Authentication Details need to be passed when sending email from gmail NetworkCredential mailAuthentication = new

jqgrid jsonReader configuration

大城市里の小女人 提交于 2019-11-28 05:38:13
问题 I'm new to jqgrid finally i've setup a grid. Suppose i need to setup jsonReader so that the grid knows where to get my grid-data in the json return. However i got blank cells after trying for days. Here is my grid: jQuery("#list48").jqGrid({ url: 'dbtest.aspx/get_offsite_history2', datatype: "json", mtype: 'POST', ajaxGridOptions: { contentType: "application/json" }, serializeGridData: function(postData) { return JSON.stringify(postData); }, jsonReader: { root: function(obj) { alert(JSON

WebMethod not being called

为君一笑 提交于 2019-11-28 02:01:52
I am passing a javascript variable containing a string to the server via jquery.ajax. Although the "success" condition is called, the server-side WebMethod is never called. Client: $.ajax({ type: "post", url: "Playground.aspx/childBind", data: {sendData: ID}, //contentType: "application/json; charset=utf-8", dataType: "text", success: function (result) { alert("successful!" + result.d); } }) Server: [WebMethod] public static string childBind(string sendData) { return String.Format("Hello"); } Try following fixes for your Ajax request: $.ajax({ type: "post", url: "Playground.aspx/childBind",

asp.net call WebMethod from Javascript asyncronous

≡放荡痞女 提交于 2019-11-28 00:26:49
I am trying to build an asp.net(c#) page that updates some state texts every second. Now I have implemented an button that calls another PageMethod which restarts something and takes a little while. The problem is, that when I call the restart PageMethod , the update PageMethod can't update as long as the restart method is proceeding... I wrote a little example to show what I mean: WebMethods in my Page: [WebMethod] public static string Update() { //return "a" to see when the Update PageMethod succeeded return "a"; } [WebMethod] public static string Restart() { //the restart will take a while

Get Json Data From Asp.Net Webmethod and Consume in angularJS

半腔热情 提交于 2019-11-27 22:39:25
问题 Can any one guide me how to get json data from asp.net webmethod, and consume it in angularJS. app.controller('MainController', ['$scope', function ($scope, $http) { try { $http({ method: 'GET', url: 'ProblemList.aspx/GetProblemList' }) .success(function (data, status, headers, config) { alert(data); }).error(function (data, status, headers, config) { }); } catch (e) { throw e; } 回答1: I had the same issue, I tried many different ways, this is the way I found it works... ( I think the tricks

How to call webmethod in Asp.net C#

喜你入骨 提交于 2019-11-27 21:22:06
I want to call a web method in asp.net c# application using the following code Jquery: jQuery.ajax({ url: 'AddToCart.aspx/AddTo_Cart', type: "POST", data: "{'quantity' : " + total_qty + ",'itemId':" + itemId + "}", contentType: "application/json; charset=utf-8", dataType: "json", beforeSend: function () { alert("Start!!! "); }, success: function (data) { alert("a"); }, failure: function (msg) { alert("Sorry!!! "); } }); C# Code: [System.Web.Services.WebMethod] public static string AddTo_Cart(int quantity, int itemId) { SpiritsShared.ShoppingCart.AddItem(itemId, quantity); return "Add"; } But

Calling webmethod ina aspx.cs file using jquery ajax

走远了吗. 提交于 2019-11-27 15:32:51
I have a default.aspx.cs which contains my webmethod to call and I have my js file that containg my jquery ajax. I can't get to call the webmethod. Here is my default.aspx.cs: protected void Page_Load(object sender, EventArgs e) { string[] MyArray = new string[1]; MyArray[0] = "My Value"; Grid1D.DataSource = MyArray; Grid1D.DataBind(); } [WebMethod] public Details[] getDetails(string columnname, string inputVal) { List<Details> list = new List<Details>(); DbAccess dbacc = new DbAccess(); DataTable dt = dbacc.getReportDetails(columnname, inputVal); foreach (DataRow row in dt.Rows) { Details

Authentication failed during call webmethod from jquery.ajx with AspNet.FriendlyUrls and AspNet.Identity

依然范特西╮ 提交于 2019-11-27 15:30:36
If I call webmethod from jQuery.Ajax with installed Nuget packages Microsoft.AspNet.FriendlyUrls v 1.0.2 and Microsoft.AspNet.Identity v.1.0.0., then I get the data object, but without data.d but with property Message 'Authentication failed'. My Webmethod.aspx is: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>WebMethod</title> <script src="Scripts/jquery-2.0.3.js"></script> </head> <body> <form id="form1" runat="server"> <h3>Test Webmethod</h3> <div id="greeitng"></div> <div id=