AJAX :: ASPX WebMethod Not Running The WebService Webmethod Returning The Page?

May 19, 2010

I have a service that works great on my development box. It uses JQuery to hit my web service, and then the JSON results are sent back.

The web service is located on our basePage.cs. We didn't want to put out an external WebService for this. Our on beta box something different is happening.

The web page seems to be trying to call the web method correctly - the JSON data is being sent... but the server doesn't seem to know it's a webmethod. here's my service function (it's in our basepage.cs which inherits from Page).


View 2 Replies

Similar Messages:

JQuery :: Returning A Json String From A Webmethod From An Aspx Page?

Nov 27, 2010

My Problem is that i am returning a json string from a webmethod from an aspx page.

I want to create a dynamic html table using that json string but found no solution for that.

Can anyone Provide me the solution to generate html table from json string ?

View 6 Replies

AJAX :: Advantage Of [WebMethod] Function At Aspx Page Called By JS Code?

Dec 19, 2010

I have this function in aspx page.


and I call this function from JavaScript as below:


I want to know what is this technique called and what is the advantage of calling the function on that way

View 3 Replies

AJAX :: Access Hidden Field In ASPX Page In WebMethod In Code

Aug 20, 2012

Looking for sample to access the hidden variable which is declared in the aspx page in the webmethod.

View 1 Replies

AJAX :: Returning DataSet / Datatable From Webmethod To Javascript

Sep 16, 2010

I have a simple web method written in the code-behind (not a separate asmx) of a test aspx page.

All it does is return a DataTable(or DataSet) both are failing, gives a blank 500 error saying "There was an error processing the request"

If I switch the return variable type to String, it works fine

I think my issue has to do with the version of the System.Web.Extensions, is that the assembly that actually contains the JSON communication implementation?

I've read all kinds of tutorials about how it should be possible to return the DataTable to javascript and then read the properties with javascript syntax.

For some reason it isn't working for me.

My web extensions is imported through my web.config with the following version

Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

View 5 Replies

Jquery - WebMethod Returning JSON But The Response Obj In $.ajax() Callback Is Only A String

Mar 8, 2011

public class JsonBuilder
private StringBuilder json;
public JsonBuilder()
json = new StringBuilder();
public JsonBuilder AddObjectType(string className)
json.Append(""" + className + "": {");
return this;
public JsonBuilder Add(string key, string val)
json.AppendFormat(""{0}":"{1}",", key, val);
return this;
public JsonBuilder Add(string key, int val)
json.AppendFormat(""{0}":{1},", key, val);
return this;
public string Serialize()
return json.ToString().TrimEnd(new char[] { ',' }) + "}";

Here is the Web Method [WebMethod]

public static string GetPersonInfo(string pFirstName, string pLastName)
var json = new JsonBuilder().AddObjectType("Person");
json.Add("FirstName", "Psuedo" + pFirstName).Add("LastName", "Tally-" + pLastName);
json.Add("Address", "5035 Macleay Rd SE").Add("City", "Salem");
json.Add("State", "Oregon").Add("ZipCode", "97317").Add("Age", 99);
return json.Serialize();

View 1 Replies

Can't Retrieve Value In The Webmethod Of The Aspx Page

Mar 17, 2011

I set the Session["PhotoId"] in a normal aspx. But I can't retrieve value in the webmethod of the aspx page.

public static string Submit(string data1, ...)
string test = HttpContext.Current.Session["PhotoId"]; // test is null

What should I do?

View 2 Replies

C# - Returning Multiple Values To Be Used In JQuery From A WebMethod

Mar 3, 2011

I have jquery using ajax/json to grab an elements ID and then hits:

public static string EditPage(string nodeID)
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(Global.conString))
using (SqlCommand cmd = new SqlCommand("contentPageGetDetail", con))
cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = Global.SafeSqlLiteral(nodeID, 1);
cmd.CommandType = CommandType.StoredProcedure;
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
if (dt.Count > 0)
string pageTitle = dt.Rows[0]["Title"].toString();
string contentID = dt.Rows[0]["ContentID"].toString();
return pageTitle, contentID, nodeID;
return "Failed";

When it's time to return I want to grab all content returned from the stored procedure back to the jquery method in the success section and set a hiddenfield, dropdown value, and a title in a textfield. In the jQuery I tried using "pageTitle" but it came up undefined. What do I need to do jQuery side to grab whats being returned and populate fields in my Web Form before showing the form?

View 3 Replies

C# - Webservice Remove NameSpace From WebMethod Parameter

Apr 1, 2011

I Have Create the webMethod

public void GetCommission(List <BOLibrary.Flight.DTContract>Loc)

At the client side i am Passing the parameter Client

List<BOLibrary.Flight.DTContract> BoList = new List<BOLibrary.Flight.DTContract>();
BOLibrary.Flight.DTContract dtConboj = new BOLibrary.Flight.DTContract();
dtConboj.ValidatingCarrier = "AA";
BOLibrary.Flight.DTContract[] pass = BoList.ToArray();

But the Problem is that the service.GetCommission(pass) accpect the argument of servicenameSpace.DTContract but in client in client i have BOLibrary.Flight.DTContract so how can i pass the parameter to the to the Service.

View 5 Replies

AJAX :: Get Page Controls In WebMethod?

Mar 1, 2010

I'm passing a value from a JQuery to the serverside & now i have to update with the database by looping through all the datalist items...




public static string addRoomAndBed(string name, int dutyid)
return null ;

View 7 Replies

C# - Catching A Custom Exception Thrown By A WebMethod On WebService

Oct 1, 2010

I have a classical asp.net web service (asmx) and a web method in it. I need to throw a custom exception for some case in my web method, and I need to catch that specific custom exception where I call the web service method.


However, I cannot do that because when I add the web service reference on the client, I have service class, input and output classes, but I do not have custom exception class.

Also another problem is that, I have also problems with serializing Exception class (because of Exception.Data property implements IDictionary interface)

Is there a way to do this in my way, or am I in a completely wrong way, or is there something I miss about fundamentals of web services?

View 2 Replies

Ajax Calling A Page Webmethod Using Jquery

Dec 10, 2010

my page Evaluation.aspx has this code


and I am calling the webmethod by javascript like this

The result is, I get the error function running and I get "undefined error" alert.Am I calling the procedure correctly? I put a breakpoint on the webmethod and it.

View 1 Replies

Web Forms :: AJAX, Get Page Object In WebMethod ?

Jan 30, 2010

I've a problem: I've a GridView, with a folder structure, and an asp.net checkbox for each row in the gridview.Now, when the user clicks the delete button, it should delete all the folder entities where the user checked the checkbox.The problem is, there may not be a postback...So I used to use findcontrol in an ordinary asp.net button codebehind, but in a webmethod, it's impossible to access the page object, because WebMethods need to be static...Now I tried ctype(httprequest.current.request.handler,page) but that doesn't seem to work...

How can I get the page object to use findcontrol ?

View 2 Replies

AJAX :: Access A Page Property From Inside A WebMethod?

Jul 22, 2010

Within a WebMethod I need to access a Page Property. The code is generating an error:

Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class

Is it possible to access page properties from WebMethods?

Here's my code:


View 8 Replies

AJAX :: Return Json Format From Page's Webmethod?

Jun 7, 2010

I have the following web method , no success on return a correct Json format.


GetAll() return list of type "Company" POCO classes.

The web method complaint type "Company" could not cast to object. However I could not just return the Company type because client side Json only accept its 2 properties -"CompanyName", "ID" and I want to keep it that way.

Of cause, I had tried create a CompanyDTO which only have those two properties, but same error - "Unable to cast object of type..."

How should I modify in my web method to make it able to return a list of partial "Company" type in Json format?

View 4 Replies

Data Controls :: Pass DataTable Or Dataset As Parameter To WebMethod Of WebService

Mar 16, 2014

can datatable pass to web service as input parameter? i have a scenario to pass values as datatable to web service. eg as follows

when Invoice or Bill is entered, I want to send the entered data as datatable to web service to insert into another application.

View 1 Replies

AJAX :: Redirect To Another Page Based On Response From WebMethod Using JQuery

May 7, 2015

I have a webmethod named (abc), inside this webmethod code i want to redirect to another webform and i am using this code.


But this code is not working. How to redirect to another page from webmethod.

View 1 Replies

AJAX :: Pagemethod Calling Webmethod In Updateprofile.aspx Is Not Working / Getting "undefined" Exception

Nov 24, 2010

I have register.aspx at root level folder and updateprofile.aspx in folder /secure/user/ .

pagemethods are working good at root level folder aspx pages only.

pagemethod calling webmethod in updateprofile.aspx is not working. Getting "undefined" exception.

Why is this so?

View 3 Replies

Web Forms :: Error While Accessing Page Label Control In WebMethod During AJAX PageMethods Call

Jul 16, 2012

I found this Article from link : [URL] .... that explains how to call server-side Method from javascript,

I used your code, my server-side function is static, public, and also I added

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">

View 1 Replies

AJAX :: Add ModalPopupExtender On A Web Page - Webmethod "contextKey" Is Getting Passed As Null?

Jun 6, 2010

I have added aiax ModalPopupExtender on a web page


to fetch data to popup control dynamically I used webservice [WebMethod]public string getIssueDetails(string contextKey){ } But before that I set ModalPopupExtender1.DynamicContextKey = "1_1_60"; in code behind.But problem is in webmethod "contextKey" is getting passed as null.

View 1 Replies

AJAX :: AutoCompleteExtender Not Calling WebMethod

Sep 10, 2010


View 3 Replies

JQuery :: Loading From [webmethod] Using Ajax

Mar 26, 2011

I am using a webform and trying to use a $.ajax call a webmethod on my code behind to format and return some data. It sounded easy but I need the help of an expert. Here is what I have and perhaps someone could steer me in the right direction to solving this problem. for the time being all I want the [webmethod] to return is some dummy data so the jqgrid displays, after I get it displaying correctly I will work on the data column format. So for this sample to work correctly user would open web from and click on button "Load Grid" when this is clicked it calls the the [webmethod] on the server, the sever then gets the data and passes it back to the jquery .ajax call and then it gets loaded into the jqGrid.


and the codebehind


View 2 Replies

AJAX :: Access UI Element Through Webmethod?

Jan 7, 2011

I would like to write some html content to div element through web method. The web method should be like

[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static string LoadImages1()


without passing data to success block, I have to write at webmethod it self.

View 1 Replies

AJAX :: How To Call WebMethod Using AngularJS

May 7, 2015

I am trying to create a function that when a button is clicked it will pass all my records to my json page which will save my data. This is what i have so far

var t = this;
t.RecordsSave = function ($http) {
for (var i = 0; i <t.records.length; i++) {
var record=t.recordss[i];
var data = params( {
record: record.Number[i],

[Code] ....

I get the following error "params is not defined"

and "Cannot read property '0' of undefined"

How should i go about this. not familiar with angular js

View 1 Replies

AJAX :: Calling WebMethod Using JQuery

Feb 25, 2016

I am trying to implement your code in "Calling ASP.Net WebMethod using jQuery AJAX", but the alert is giving me the value "Undefined".

I believe my website (asp.net c#) is not correctely configured for webmethods.

View 1 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved