FAQ Database Discussion Community


Binding Lable from webmethod using ajax

asp.net,ajax,webmethod
Hi guyes i am trying to read data from webmethod and pass the value to my lable in aspx page. for this i take a use of Ajax and webmethod. my problem is when i am not able to bind data on success to my lable controle. my .asmx page....

Json Output of a C# WebMethod Does Not Affect a JQuery's DataTable

c#,jquery,asp.net,datatables,webmethod
I've been stuck with this issue for a while now, each time getting a different error or some sort of a problem which does not help me achieve my goal. I am using the table plug-in for jQuery and I can't seem to get a proper Json response from me...

onSuccess and onFailure doesn't get fired

javascript,c#,asp.net,webmethod,pagemethods
I have used onSuccess and onFailure in my PageMethod call. However neither of them gets called and the WebMethod doesn't get fired either. alert("1"); PageMethods.LoginUser(onSuccess, onFailure, email, pass); alert("2"); function onSuccess(val) { } function onFailure() { } [WebMethod(EnableSession = true)] public static int LoginUser(string email, string pass) { //Doesn't get...

calling webmethod from jquery C# returning 404 error in .net aspx page

c#,jquery,asp.net,webmethod
must be missing something basic here. I am getting a 404 error calling a webmethod from jquery in an aspx page I'm running locally. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="empJquery.aspx.cs" Inherits="webApiOracle.empJquery" %> <!DOCTYPE html> <html lang="en"> <head runat="server"> <title>jquery emps</title> <script src="Scripts/jquery-1.10.2.min.js"></script> <link href="../Content/bootstrap.min.css" rel="stylesheet" /> <script type="text/javascript">...

ASP.NET execute WebMethod with Jquery/AJAX

javascript,jquery,asp.net,ajax,webmethod
I have one WebMethod that will execute some DB search and return it's data in some HTML template. I need to execute this method using jquery to populate an area of the website but the problem is that my website URL/URI is dynamic. My URL is http://site/school-name/home. The school-name will...

Call Javascript function from C# static web method (page method)

javascript,c#,asp.net,static,webmethod
I used: ScriptManager.RegisterStartupScript(this, GetType(), "", "MyJSFunction('parameter')", true); to reach the MyJSFunction function in JavaScript from Page_Load and it worked fine. Now I'm in need of calling lets say the same function but from a static web method, but I get these 2 errors on this & GetType(): this: Keyword 'this'...

Accessing jQuery returned value

javascript,c#,jquery,asp.net,webmethod
I'm trying to access the returned value and add a check of .contains so I can know if I need to reload the page or not. I've been trying to do something like the following: alert(msg.d); if(msg.d.contains("deleted")) location.reload(); The returned object is a string. It does show me the alert...

C# WebMethod - Send and receive same custom object as parameter

javascript,c#,json,webmethod
mycode: object: public class Person { private string _Nome; private DateTime _Nascimento; public string Nome { get { return _Nome; } } public DateTime Nascimento { get { return _Nascimento; } } public Person(string Nome, DateTime Nascimento) { _Nome = Nome; _Nascimento = Nascimento; } } page (WebMethods): [WebMethod] public...

Declare a single static variable that will be used by many WebMethod functions

c#,asp.net,session-variables,code-behind,webmethod
I have a session variable that I need to use on a cs page with many webmethod functions. If I declare it as follows I don't always get the latest variable. Sometimes it gives me the variable that was stored before the last one. What am I doing wrong? public...

Send large canvas data to server

c#,ajax,canvas,webmethod,todataurl
I have tried sending canvas data as an image but when the image is big it is not sending the data so I tried to send as form data but i am stuck in receiving the code. The codebehind receives as htmlinputelementobject. How can I receive it? Can someone please...

AJAX Call in ASP.NET not Firing Server Side Method

jquery,asp.net,ajax,asp.net-ajax,webmethod
I'm developing on asp.net webforms and can't solve an issue while making an ajax call from client side. I got the client side script: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $.ajax({ type: "GET", url: "Default.aspx/getnewmails", data: {}, dataType: "html", success: function (str) { $("#div2").html(str); } }); }); </script>...

jQuery AJAX doesn't hit WebMethod

jquery,asp.net,ajax,post,webmethod
You might wonder it as a duplicate post. But, I have researched a lot on various blog but I could not understand what the mistake I 'm doing. I'm calling a web method as below $.ajax({ type: "POST", url: "test.aspx/Save", data: "{ 'Id': 'test', 'newvalue': 'test' }", contentType: "application/json; charset=utf-8",...

Lazy loading in Gridview using jquery and webmethod

jquery,asp.net,web-services,web,webmethod
How to use lazy loading in gridview by binding datatable to gridview using webmethod and jquery. A Gridview contain more than million records. Lazy loading is depend upon gridview scrolling.

How to get Page.UICulture in a static WebMethod?

c#,asp.net,.net,code-behind,webmethod
How to get the Page.UICulture in a static WebMethod function. The following gives me an error: Page.UICulture = System.Threading.Thread.CurrentThread.CurrentCulture; The error I get: An object reference is required for the non static field,method or property ...

Webmethods with HttpContext.Current.User.Identity.IsAuthenticated stop working after inactivity on Azure

c#,asp.net,azure,session-variables,webmethod
I'm testing the Azure server with pages that use Ajax(json)/Webmethod functions. Some of those functions check HttpContext.Current.User.Identity.IsAuthenticated before they run code. Unfortunately, if a user is logged in and the page doesn't make a full postback request to the server, only those webmethods functions that check HttpContext.Current.User.Identity.IsAuthenticated stop running completely...

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

c#,ajax,webmethod
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) { this.bgc1.BGEnabled = false; } [WebMethod(EnableSession = true)] public static...

Cant Deserialize json string with JavaScriptSerializer

c#,asp.net,webforms,webmethod
From javascript I sent to a webmethod the following : var firstname = $("#txtfirstname").val(); var lastname = $("#txtlastname").val(); var dataFilter = { "filterType": "fn_ln", "data": { "firstName": firstname, "lastName": lastname } } var data = JSON.stringify(dataFilter) data = data.replace(/\"/g, '\''); datatoSend = '{ filters:"' + data + '" }'; I...

Determining url for Ajax WebMethod (in Sitefinity)

asp.net,ajax,json,webmethod,sitefinity
I'm trying to figure out how to determine what the baseUrl should be for this ajax webmethod POST. According to this Sitefinity thread, the baseUrl is the path to the Sitefinity project folder. In my case, the path should something along the lines of: "C:\inetpub\Website\Public" but this path is not...

How to get only string from HTTPResponse RestApi Android

android,http-post,httpresponse,webmethod
I have tried this code snippet to get the response from android using HTTPResponse String s=""; try { HttpClient httpClient=new DefaultHttpClient(); HttpPost httpPost=new HttpPost("http://10.0.0.8:7777/HttpPostServlet/servlet/Login"); List<NameValuePair> list=new ArrayList<NameValuePair>(); list.add(new BasicNameValuePair("uname", valuse[0])); list.add(new BasicNameValuePair("pwd",valuse[1])); httpPost.setEntity(new UrlEncodedFormEntity(list)); HttpResponse httpResponse= httpClient.execute(httpPost); HttpEntity...

Accessing Separate C# file from JavaScript WebMethod

javascript,c#,asp.net,webmethod
I can get this to work if I have the c# [WebMethod] code in the default aspx.cs file but I cannot get it to work for a separate c# file I get a "webmethods undefined". I have the script manager set to EnablePageMehods = true. My separate class looks like...

Add objects to list in web application

c#,asp.net,web-services,list,webmethod
I've been trying to create a simple web application that registers users and saves their details using a list. Problem is that after adding the user successfully in the first call to the RegisterUser function, the list is empty again in the second call. Does it have anything to do...

Call WebMethod from jqGrid

jquery,asp.net,jqgrid,webmethod
I am learning jqGrid and following this link. However demo is build in Asp.Net MVC and I am trying it using Asp.Net WebForms. My debugger is not stepping in into WebMethod Here is my code $("#tblDemo").jqGrid( { url: 'Default.aspx/GetGridData', datatype: "json", mtype: 'GET', colNames: ['Id', 'First Name', 'Last Name'], colModel:...

Webmethod does not fire

c#,asp.net,webmethod
I download a source code, and I tried it in Visual Studio 2013, and it didn't work, but it works when I use Visual Studio 2010, which I think there is a trick in ASP.Net 4.5 that I don't know about. Here is the code: function Load(Skip, Take) { $('#divPostsLoader').html('<img...