webmethod

Ajax PageMethod accessing page-level private static property

自作多情 提交于 2019-12-11 12:09:44
问题 I have a page that uses Ajax Page Methods. When the page first loads, the user is prompted to select a year. This is the only time that a PostBack occurs. The year is stored in a private static page-level integer property named SelectedYear. There are several page methods that pass data from the client to the server, but the year is always stored on the server, so that it won't have to be to be passed in again. The problem is, in a few cases, within the server WebMethod, the SelectedYear

Getting Values of a JSON Object in vb.net

拟墨画扇 提交于 2019-12-11 11:32:49
问题 EDITED: I got stuck while getting value of a JSON object in vb.net. My JSON request posts data like given below: function submitEmail() { var ClientsPersonalInfo = { FullName: $("#FullName").val(), PhoneNumber: $("#PhoneNumber").val(), EmailAddress: $("#EmailAddress").val(), DOB: $("#DOB").val(), Occupation: $("#Occupation").val(), NINumber: $("#NINumber").val(), FullAddress: $("#FullAddress").val() } var ClientsData = {}; ClientsData.ClientsPersonalInfo = ClientsPersonalInfo; var d = '{

Pass json/javascript data/objects to c# function using ajax

吃可爱长大的小学妹 提交于 2019-12-11 10:34:16
问题 I'm using FullCalendar (http://arshaw.com/fullcalendar/) and I need help with passing data using json to a c# function in the code behind page of my ASP.net page. I am using json to load data like so in my FullCalendar web application: Code behind: [WebMethod] public static List<Event> GetEvents() { List<Event> events = new List<Event>(); events.Add(new Event() { EventID = 1, EventName = "EventName 1", StartDate = DateTime.Now.ToString("MM-dd-yyyy"), EndDate = DateTime.Now.AddDays(2).ToString

How to change ASP.NET WebMethod's 'd' identifier in a JSON response, to a different name?

我与影子孤独终老i 提交于 2019-12-11 09:06:16
问题 This works: through jQuery I'm using a jQuery.ajax(..) call to a page e.g. Default.aspx/GetStatus having a WebMethod attribute: // Default.aspx [WebMethod()] static public bool GetStatus(long id) { //... The JSON response contains the correct boolean value in the format { d: true } . However I don't understand the origin of the resulting "d" member name. Where does the "d" identifier come from (how is it decided) and how can I change its name? 回答1: What does .d in JSON mean? 来源: https:/

Unable to call server side webmethod function

二次信任 提交于 2019-12-11 07:48:15
问题 I am using summernote, I want to upload image to my web server.. Below is my code which I am using Default.aspx <script type="text/javascript"> $(document).ready(function () { $('#summernote').summernote({ onImageUpload: function (files, editor, $editable) { alert('image?'); var formData = new FormData(); formData.append("file", files[0]); $.ajax({ url: "Default.aspx/UploadImage", data: formData, type: 'POST', cache: false, contentType: false, processData: false, success: function (imageUrl)

Calling a function / database update using Ajax via Jquery

不想你离开。 提交于 2019-12-11 07:39:43
问题 Im creating a simple "Was this useful?" form with Yes and No objects- Using ASP.net webforms. I need the submission to be done via ajax using jquery, to prevent a user from voting multiple times on the same page.. currently i have two methods Like_Click and Dislike_click in the C# code behind the page in question. Can anyone give me some pointers on or a link to any suitable walkthroughs for simple ajax via jquery (I'm new to ajax!) Ive looked at using the [WebMethod] identifier on each of

Calling ASP.Net Web Methods with Angular 2

China☆狼群 提交于 2019-12-11 07:26:09
问题 I seem to have a simple scenario but I can't get it to work... I have an ASPX page with code behind. I want to access the Web Methods in the code behind. To do this I added a subscriber in my app.component.ts that calls the service which returns an observable. The service should call my web method. Here's my code: service.component.ts import { Injectable } from '@angular/core'; import { Http, Response, RequestOptions, RequestMethod } from '@angular/http'; import { Observable } from 'rxjs

InvalidOperationException despite MaxJsonLength = Int32.MaxValue

一世执手 提交于 2019-12-11 06:29:12
问题 I don't think I'm exceeding the MaxJsonLength, but I'm still getting "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property". I checked to see how long the result is, and it's 25,000 rows. I checked the average length of each row by outputting a smaller result, and the average row is 48.5 characters long. 25,000 * 48.5 characters = 1,224,140 characters. MS says that maxJsonLength is in

How to get only string from HTTPResponse RestApi Android

六月ゝ 毕业季﹏ 提交于 2019-12-11 04:21:54
问题 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

Can I change a parameter name in a C# WebMethod?

我们两清 提交于 2019-12-11 03:43:24
问题 Is it possible for a C# WebMethod to accept a different parameter name than its client sends? For example, given a client sending this message: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetStatus xmlns="http://example.com/"> <Arg1>5</Arg1> <Arg2>3</Arg2> </GetStatus> </soap:Body> </soap:Envelope> Can the existing