webmethod

Inconsistent LinkButton PageMethod behavior in different browsers

偶尔善良 提交于 2019-12-03 22:00:13
I have a LinkButton on a page that performs a post-back, but also has an onClientClick event. The idea is to set some session variables in the background from client-side data (don't ask). I've placed a break point in the web method to step through our code, and what we're experiencing is that depending on the browser, the PageMethods may return a success message, failure message, or no message at all . Additionally, the web method may or may not get called, regardless of the PageMethods result. Here's a handy little chart of our results: Browser PageMethods WebMethod -------------- ----------

How to return multiple values from a webservice?

给你一囗甜甜゛ 提交于 2019-12-03 05:58:57
问题 I am very new to the world of web services so please bear with me. I am creating a very simple web service in Visual Studio 2010 using .asmx files. Here is the code I am using: namespace MyWebService { [WebService(Namespace = "http://www.somedomain.com/webservices")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] public class Service1 : System.Web.Services.WebService { [WebMethod] public string simpleMethod(String str) { return "Hello

How to map json output from [WebMethod] to d3.js bar charts

拈花ヽ惹草 提交于 2019-12-02 16:19:58
问题 Hi I am new to d3.js.I have this following [WebMethod] in .aspx file: [WebMethod] public static List<Product> GetProductsLINQ() { List<Product> lstProducts = new List<Product>(); DataTable dtProducts = new DataTable(); string sqlQuery = "SELECT Product_Name, Purchase_Price FROM tblProductMaster"; string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["BTrax"].ConnectionString; SqlConnection conn = new SqlConnection(connectionString); SqlDataAdapter da = new

Use AJAX to submit data from HTML form to WebMethod

℡╲_俬逩灬. 提交于 2019-12-02 11:43:46
问题 So I'm taking in data from an HTML form and then using AJAX to send the data to a web method to then be sent to a sqlite database, but my AJAX call is failing. What did I mess up? Am I doing it correctly? HTML Form <form id="addForm" > <input type="text" name="playername" id="playername" placeholder="Player"/> <input type="text" name="points" id="points" placeholder="Points" /> <input type="text" name="steals" id="steals" placeholder="Steals" /> <input type="text" name="blocks" id="blocks"

How do i pass parameters from JQuery to ASP.NET webmethod?

那年仲夏 提交于 2019-12-02 09:31:39
问题 I have written this jQuery ajax method below which calls a webmethod. The call happens fine except the parameter which is a User object has empty fields. I can see the values in firebug when i debug but they do not get through to the User object parameter in the webmethod There are two values i am trying to pass from the my jQuery method to the Webmethod which are "UserID" (Guid) and "About" (string) which are both properties of the User class, but on the service end, the User object is just

how to use webmethod with telerik batch edit grid

我怕爱的太早我们不能终老 提交于 2019-12-02 09:04:00
Work on Asp.net vs2012 C# telerik:RadGrid batch edit,I put save button outside from the grid.Under the save button want to call webmethod to save all changes on my db. Sample will be preferable,how to use webmethod with batch edit grid. Use RadClientDataSource to bind to your service: http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/client-data-source-binding/defaultcs.aspx 来源: https://stackoverflow.com/questions/28870389/how-to-use-webmethod-with-telerik-batch-edit-grid

The Correct way to pass FileUpload content into [WebMethod]?

≡放荡痞女 提交于 2019-12-02 06:56:32
I have a [WebMethod] Sendemail This works fine but now i what to upgrade it to send attachments. I am using a fileupload. This is my method Call. lblEmailSent.Text = Send.Sendemail(txtTo.Text, txtSubject.Text, txtbody.Text, FileUpload1.PostedFile.FileName, FileUpload1.FileContent); My Call Statement is underlined in blue and the two error given look like: * 1) *The best overloaded method match for 'WebTestServiceApp.localhost.Service1.Sendemail(string, string, string, string, WebTestServiceApp.localhost.Stream)' has some invalid arguments * 2) *Argument 5: cannot convert from 'System.IO.Stream

Hide asmx web methods conditionally in C#

≯℡__Kan透↙ 提交于 2019-12-02 06:42:36
问题 How can I conditionally hide the web methods? I don't want to expose the web method if a flag setup in web.config is false. If it is true, then I will expose the web method. Meaning: The method should only be visible to the client if the flag is true otherwise it should not be available for the client. Is this possible in C#? 回答1: You can check the flag in your method and throw an exception if it's not set. 回答2: You can't really do this. Your clients "see" the web methods because they are

AJAX to web method not returning JSON

人盡茶涼 提交于 2019-12-02 06:18:16
I am calling a web method in aspx page from my js file using AJAX. I have set the method to be [WebMethod] and the page inherits from System.Web.Ui.Page class. Still it does not return the JSON format to my calling ajax function. Here is the AJAX call in js file: $.ajax({ type: "POST", url: "/WebServiceUtility.aspx/CustomOrderService", data: "{'id': '2'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (message) { ShowPopup(message); } }); function ShowPopup(result) { if (result.d != "") { request=result.d; } } And here is the web method: using System;

Hide asmx web methods conditionally in C#

吃可爱长大的小学妹 提交于 2019-12-02 05:34:59
How can I conditionally hide the web methods? I don't want to expose the web method if a flag setup in web.config is false. If it is true, then I will expose the web method. Meaning: The method should only be visible to the client if the flag is true otherwise it should not be available for the client. Is this possible in C#? You can check the flag in your method and throw an exception if it's not set. You can't really do this. Your clients "see" the web methods because they are listed in the WSDL. The WSDL generation is fairly static - it is based on the [WebMethod] attributes on your methods