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...

JQuery:

PageMethods.addRoomAndBed(empname,Number(roomId));

C#:

[WebMethod]
public static string addRoomAndBed(string name, int dutyid)
{
// MANIPULATE DATALIST AND UPDATE DATABASE HERE
return null ;
}

View 7 Replies


Similar Messages:

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).

[Code]....

View 2 Replies

Ajax Calling A Page Webmethod Using Jquery

Dec 10, 2010

my page Evaluation.aspx has this code

[Code]....

and I am calling the webmethod by javascript like this
[Code]....

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:

[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.

[Code]....

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

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.

HttpContext.Current.Response.Redirect("../paypal_redirect.aspx",false);

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

View 1 Replies

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

Dec 19, 2010

I have this function in aspx page.

[Code]....

and I call this function from JavaScript as below:

[Code]....

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

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

[System.Web.Services.WebMethod] 
and
<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


<ajaxToolkit:ModalPopupExtender
ID="ModalPopupExtender1"runat="server"[code]....

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

WCF / ASMX :: [WebMethod] Alternative / Use AJAX, Primarily With JQuery .ajax Function?

Feb 22, 2011

HWhen I want to use AJAX, primarily with JQuery .ajax function, I use functions within the .aspx.cs of the same page with [WebMethod].

I dont like this method very much because everyone can tell which function I use, and with no problem they can use it too.

My guess is that theres a better way to do this, Am I right?

View 3 Replies

Data Controls :: Pass JSON Data Object From JQuery AJAX To WebMethod

May 7, 2015

I want to send single json object with nested arrays through jquery ajax method.

In Code

In jquery ajax i am passing LeaveRuleMaster a single json object which holds some properties (Leavetypeid, Leavename, Leavestatus and nested array LeaveRulespecific.

In vb.net code i can receive the value of properties(Leavetypeid,Leavename,Leavestatus)

but i am receiving the LeaveRuleSpecific as nothing.

Based on the following link i tried this [URL] .....

View 1 Replies

AJAX :: AutoCompleteExtender Not Calling WebMethod

Sep 10, 2010

[Code]....
[Code]....

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.

[Code]....

and the codebehind

[Code]....

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

[System.Web.Services.WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static string LoadImages1()
{

[Code]....

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

AJAX :: JQuery WebMethod Not Getting Called?

May 7, 2015

My problem is that I have a jqury function basically I want to add gridview row into data base .so that pupose I am doing that by accessing webmethod ,but the web method can’t call from that code .

My data can’t save into data base I will check it.value should be passed but problem is that this function can’t call webmethod I will check it doing debudg.

my function should be call  webmethod

Following my code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"> </script>
<script type="text/javascript">
$(function () {

[Code].....

View 1 Replies

AJAX :: Toolkit:AutoCompleteExtender Return From Webmethod ?

May 7, 2010

i have used AjaxToolkit:AutoCompleteExtender, which calls a web method to get string array. Everything was working fine as its populating all the data.But the issue arise when web method is returning value in a string array like

arr[0]=1-12-100

arr[1]=1-10-100

the value im getting in the AutoCompleteExtender is the subtract of the result like

arr[0]=-111

arr[1]=-109

Why is it treating it like numeric and doing calculation when the return type is actual an string. i think its has to do sth with serialize and deserialize thing

View 1 Replies

Jquery - JQGrid - Cannot Call WebMethod But Can With Ajax

Mar 1, 2011

I am new to jqGrid and I have found it difficult to follow the documentation jqGrid Documentation / I cannot figure out how to call a WebMethod when setting up the JQGrid. I have been successful in making an Ajax call to get the data and then setting up the JQGrid with local data. I think its an extra step in the setup process and that I should be able to provide the path to the webmethod using the url property. The editurl property is the same way. I am never actually receiving the post to the server. Attempted JQGrid Setup

function GetData()
{
$('#list').jqGrid({
type: "POST",
url: "Default.aspx/GetUsersJSON",
datatype: "json",
height: 250,
colName: ['Username', 'Email'],
colModel: [
...
}).jqGrid(
'navGrid',
'#pager',
{
edit: true,
add: true,
del: true
});
}
WebMethod
[WebMethod]
public static string GetUsersJSON()
{
var users = new List();
using(UserAdministrationSandboxDataContext uasd = new UserAdministrationSandboxDataContext())
{
users = uasd.GetUserList();
}
JavaScriptSerializer serializer = new JavaScriptSerializer();
return serializer.Serialize(users);
}

Current Code I got it working correctly now, but I still have one final question. Why did I have to set the 'repeatitems: false' in order to display the content? Some of the caveats to get this to work include the different ways to setup the ajax request. (Ajax: type) is (jqgrid : mtype) (Ajax: contentType) is (jqgrid : ajaxGridOptions: { contentType: })

And finally understanding the documentation from the documentation on how to setup the JSONReader.

function GetUserDataFromServer()
{
$('#list').jqGrid({
url: "Default.aspx/GetUsersJSON",
mtype: 'POST',
ajaxGridOptions: { contentType: "application/json" },
datatype: "json",
serializeGridData: function (postData)
{
return JSON.stringify(postData);
},
jsonReader: {
root: function (obj) { return obj.d; },
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.d.length; },
id:'0',
cell:'',
repeatitems: false
},
datatype: "json",
height: 250,
colName: ['Username', 'Email'],
colModel: [
{
name: 'Username',
index: 'Username',
width: 100,
editable: true
},
{
name: 'Email',
index: 'Email',
width: 220,
editable: true
},
{
name: 'IsLockedOut',
index: 'IsLockedOut',
width: 100,
editable: true,
edittype: 'checkbox'
}
],
caption: "Users"
})
}
Web Method
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static List GetUsersJSON()
{
using (UserAdministrationSandboxDataContext uasd = new UserAdministrationSandboxDataContext())
{
return uasd.GetUserList();
}
}
One JSON Object from the List
{"__type":"UserAdministrationSandbox.UserData","PKID":"00000000-0000-0000-0000-000000000001","Username":"TestUser","ApplicationName":"Test","Email":"TestUser@test.com","Comment":"TestUser","Password":"D41D8CD98F00B204E9800998ECF8427E","PasswordQuestion":"Is this a blank Password?","PasswordAnswer":null,"IsApproved":true,"LastActivityDate":"/Date(1298869200000)/","LastLoginDate":"/Date(1298869200000)/","LastPasswordChangedDate":"/Date(1298869200000)/","CreationDate":"/Date(1298869200000)/","IsOnLine":false,"IsLockedOut":false,"LastLockedOutDate":"/Date(1298869200000)/","FailedPasswordAttemptCount":0,"FailedPasswordAttemptWindowStart":null,"FailedPasswordAnswerAttemptCount":null,"FailedPasswordAnswerAttemptWindowStart":null}

View 1 Replies

C# - JQuery Ajax WebMethod Return Object

Jan 14, 2011

I have a web Method in my C# that is called via Jquery ajax method. The web method should return an object back to the Jquery which will be used to populate. I have tried returning a JsonResult object, the actual object and nothing seems to work! I'm not using MVC (Unfortunately). Is there a way that I can return an object from my web method which can be used by my AJAX method? here is the link for my JQuery AJAX method [URL]

View 1 Replies

JQuery :: Ajax With WebMethod - Test Code

Nov 11, 2010

I use this test code and it works well :

JQuery
$(document).ready(function () {
$("#Result").click(function () {
$.ajax({
type: "POST",
url: "test-JQuery-Page-Methods.aspx/GetInfo",
data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
$("#Label1").text(msg.d);
}
});
});
});
.VB
<WebMethod()> Public Shared Function GetInfo() As String
Return "test"
End Function

Now i try to pass an argument to the function but something is wrong in my code and i dont know what is wrong... :

JQuery
$(document).ready(function () {
$("#Result").click(function () {
var textj = 'test';
var jsonText = JSON.stringify(textj);
$.ajax({
type: "POST",
url: "test-JQuery-Page-Methods.aspx/GetInfo",
data: jsonText,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
$("#Label1").text(msg.d);
}
});
});
});
.VB
<WebMethod()> Public Shared Function GetInfo(ByVal infostring As String) As String
Return infostring
End Function

View 5 Replies

JQuery :: Accessing Webmethod Via Ajax Call

Jul 6, 2010

I have 2 web pages edit.aspx and webmethods.apx. In edit.aspx there is some jquery code to get some data :

[Code]....

With this I try to get a Json object from the webmethods.aspx page :

[Code]....

I get an error back that says "Parser Error", I even did put an breakpoint on the webmethod but it is like it's never triggered. Is my url wrong if I'm in the following url :

[Code]....

Should I use something like ../WebMethods.aspx?

View 6 Replies

AJAX :: Can Not Send Complex String To WebMethod?

Mar 7, 2010

Have try to send the complex string that is created(serilize) from data.If I write just a regular string there is no problem but I want to sendover the array data as a string and then deserilize it does not work.What happens is that the webmethod 'save' never start. No error occurs!I suppose it is becouse the string contains a lot of " but I dont know howto change that and then bee able to deserilize it to the object.The string 'strData':

"{'JSONString': '[{"Show":false,"SortOrder":"","QuestionText":"Ingen rapport lämnas till kund då följande muntliga rapport har lämnats:","DefaultValue":"","CSS":"","Note":"","RQID":"Label","FunctionNr":0},{"Show":false,"SortOrder":"","QuestionText":"Lämnar

[code]...

View 2 Replies







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