Click here to Skip to main content
15,883,883 members
Everything / WebMethod

WebMethod

WebMethod

Great Reads

by Fiyaz Hasan
Building a parent child hierarchy TreeView
by MohamedKamalPharm
A step by step tutorial showing how to consume an ASMX Service from an application using AngularJS, highlighting common pitfalls.
by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
This blog will take you through the steps to call a simple WebMethod to get the details of one record shown on a Repeater and show the retrieved details on jQuery Dialog popup.
by Amit Singh Baghel
Saving Details Table Data (An HTML Table) in Database by converting it into a jagged array and passing it to a table type parameter

Latest Articles

by Amit Singh Baghel
Saving Details Table Data (An HTML Table) in Database by converting it into a jagged array and passing it to a table type parameter
by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
This blog will take you through the steps to call a simple WebMethod to get the details of one record shown on a Repeater and show the retrieved details on jQuery Dialog popup.
by MohamedKamalPharm
A step by step tutorial showing how to consume an ASMX Service from an application using AngularJS, highlighting common pitfalls.
by Fiyaz Hasan
Building a parent child hierarchy TreeView

All Articles

Sort by Score

WebMethod 

18 Jun 2014 by Kareem Abou Saad
Instead of using CreateElement((i).ToString());Use CreateElement((tagName));Where tagName could be for example FirstName or LastName, so it ends up in the XML tag asTo do this in the simplest way, create an array of fields holding literal strings like this:string[] fields =...
30 Mar 2015 by Rob Philpott
Doesn't look too far out, but your proc is only returning three columns, but you are trying to read 4. Also, I wouldn't close the connection in your loop - that sounds like a very bad idea!
11 Jun 2014 by Manikandan10
You can't do such things and there are no API for that. How can you pass the Human Verification or Captchas?
12 Jun 2014 by Jafarinejadvazifehkhorani
The only thing that you can do is using Google, Microsoft, Facebook or Yahoo as Identity provider in order to authenticate users. So , if it's the case refer to WIF(Windows Identity Foundation)
30 Mar 2015 by OriginalGriff
Um.select name, gender , totalmarks from students11 where id = @idcc.id = Convert.ToInt32(reader["id"]);If you don't SELECT it, you can't read it.And why would you want to, given that you sent it to the SP in the first place?
16 May 2015 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
You cannot, because controls are not accessible inside the WebMethods. Moreover, WebMethods are meant to take some parameter and return some value after some processing.You should rather build a client side table or something. Refer - Use jQuery and ASP.NET AJAX to build a client side...
11 Nov 2015 by Krunal Rohit
No, you cannot.You need to make the method public if you want to access in another project.publicThe type or member can be accessed by any other code in the same assembly or another assembly that references it.privateThe type or member can be accessed only by code in the same class...
12 Sep 2016 by David_Wimbley
Google is your friendHow to export excel from dataset or datatable in c#? - Stack Overflow[^]c# - Export DataTable to Excel File - Stack Overflow[^]c# - Export data from dataset to excel - Stack Overflow[^]How to create Excel file in C#[^]Export Dataset into Excel Sheet in...
14 Sep 2016 by ZurdoDev
As mentioned in comments the server should handle that for you. If you find that your server cannot handle the load then you implement load balancing or some other technique but your code will stay the same, essentially.
29 May 2014 by Prasad Khandekar
Hello,This[^] TechRepublic article should guide you. Please have a look.Regards,
11 Sep 2014 by pradiprenushe
Replace your query porion with thisList query = (from E in context.tbl_ExamCreation join EA in context.tbl_ExamAttendence on E.Exam_ID equals EA.Exam_ID join C in context.tbl_Course on E.Course_ID equals C.CourseID...
11 Sep 2014 by Oleh Zheleznyak
instead of foreach usereturn query.Select(x=>new StudentDetails() { Type = x.Type, StartDate = x.StartDate.HasValue ? x.StartDate.Value : DateTime.MinValue,...}).ToArray();
20 Sep 2014 by Shemeemsha (ഷെമീംഷ)
url: "WebForm1.aspx/GetProblems",I think this is the problem..Why this URL is like this..Use the ClassName/GetProblems Or Use the full pathUsing firebug network tab, Check the function is calling or not
13 Oct 2014 by Sergey Alexandrovich Kryukov
This is just the sequence of asynchronous operations. You don't update your variable in your function BindNewSalesAttribute; you do it in the function success. When your function BindNewSalesAttribute returns, the function object success is created, but not yet called, so the variable...
3 Jan 2015 by Fiyaz Hasan
Building a parent child hierarchy TreeView
11 Aug 2015 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Don't call a JavaScript function inside a WebMethod. What you can do is, just return from the method with any values if needed and then inside Ajax success, call the other JavaScript function. This is very easy.
22 Sep 2015 by Dawood507
Here i am returning table one row data[WebMethod]public static GalleryDetailsInPopup[] BindDatatable(int imageId){DataTable dt = new DataTable();List details = new List();using (SqlConnection con = new SqlConnection("Server=SERVER1;...
19 Nov 2015 by Sums Mohs Eds
if you need like belowmkTabl.DataSource = SqlDataSource1;mkTabl.DataBind();Change the return type of webmethod from void to Dataset or datatable.And also after executing the query fill into dataset or datatable inside the webmethod.
27 Apr 2016 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
So do like this.$(document).ready(function () { LoadBankCashList(), LoadBankCashFlowBarChart(); $("[id*=drpbankcashflowchartpaytype], [id*=drpbankcashflowchartpayid], [id*=drpbankcashflowchartdaterange]").bind("change", function () { LoadBankCashFlowBarChart(); ...
19 Sep 2016 by Karthik_Mahalingam
Quote:Uncaught ReferenceError: getdata is not definedgetdata function is enclosed with jquery, remove it. $( function getdata(obj) { and remove ) at the end of the function.
27 Mar 2017 by AnvilRanger
First you need to explain what you are attempting to do in detail. A code dump saying this is slow is meaningless to anyone on this board. We cannot see your monitor or read your mind to figure out what you are doing.If I had to guess are you trying to load a video via your Ajax call. If it...
27 Jul 2017 by F-ES Sitecore
You'll need to handle this in your calling code by returning data from your method that will tell your js that it needs to redirect; [WebMethod] public static object MyMethod() { return new { Success = false, RedirectUrl = VirtualPathUtility.ToAbsolute("~/NotAuthorized.aspx")}; } Your...
16 Oct 2017 by Karthik_Mahalingam
Quote: This may work for one use while development, but, I suspect it will definitely crash when multiple users are using the system and the same web service with different parameters. This is because it is static and may overwrite the input parameters while another call is still executing. Is...
9 Jun 2019 by MadMyche
For the infrastructure, I would actually split this up into multiple applications; this will allow you to scale the systems as needed. Part 1 would be a windows application which is just retrieving the data from whatever source and populating your data-store. Part 2 would be your web...
19 May 2014 by Jitendra Ballia
Hi,I have three autogenerated boxes and it boxes contains datepicker with same name how to bind this data in single object
21 May 2014 by kumar9avinash
Hi,its a general discussion question, when we should use web methods to fetch data from database and whether there is any performance issue , which one is faster ADO.net or Webmethod Using Ado.net through java script or Jqyery.
25 May 2014 by RajeshvPatel
1. If there is desktop application which is installed on multiple pc and that application interact with single database at that time you have to use web service concept. 2. Web Application => you have to give access some outside the resources at time web service is very useful. For example...
25 May 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Kaushal is correct. It would depend upon the amount of data you are fetching.Normally, WebMethod is faster than the Code Behind method of accessing the data from database. It also gives you the advantage of not Post Backing the form.So, upto you. Decide whether you want user to experience...
25 May 2014 by Thanks7872
See this:$(document).ready(function () { $("#btnCreate").click(function (e) { e.preventDefault(); $.ajax({ type: 'POST', url: '../Create', contentType: 'application/json;charset=utf-8', ...
28 May 2014 by Jitendra Ballia
Dear friend,Please help me. I have problem to create fileupload control using webservice and jquery in c# without using Httphandler.Have you any solution.
30 May 2014 by Member 9965416
THIS IS MY .CS CODEusing System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.Services;using System.Data;using System.Data.SqlClient;using System.Configuration;namespace...
12 Jun 2014 by IshaqSalam
I was make web services. this is my code.vb filePublic Class xlogin _ Public StatusID As Boolean End Class _ Public Function Login(ByVal sUser As String,...
19 Jun 2014 by srikanth492
here my code is and how to get column names insted of indexvalues public static void savefile_XML(string EmpId, string FirstName, string LastName, string MiddleName, string Gender, string DateOfBirth, string MobileNo, string EmailId, string Adress, string District, string State,...
17 Jun 2014 by Muhammad Taqi Hassan Bukhari
I am trying to play vimeo video in android activity, all data included comments and other stuff is displaying but video is not playing.... here is my codeinternet permisison in manifest has also been assigned..java filepackage com.example.interfaces;import...
21 Mar 2018 by sanjay30784
Dears I am accessing and work serice using SoapUi tool successful but when call web service using .net client i got following error "Element ClaimDetails from namespace cannot have child contents to be deserialized as an object. Please use XmlNode[] to deserialize this pattern of XML". My Web...
23 Jun 2014 by miss786
I trying to pass the following the web method below, through json format to a javascript function, but I am currently getting a blank page on the client-side. protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { JavaScriptSerializer jss...
23 Jun 2014 by Bitla Phanindra
Try adding these two at the top of your view.Make sure you have these js files in your Scripts folder. Download them here [^]
23 Jun 2014 by Jafarinejadvazifehkhorani
as the required json format for data table of google chart is different from the one generated from Json serilizer , you need to convert the response to the following format is different from the ordinary one{ "cols": [ {"id":"","label":"Topping","pattern":"","type":"string"}, ...
2 Jul 2014 by sanjay30784
After add web reference deserialization problem solved,deserialization problem reason -- I had added Service reference .
6 Jul 2014 by ramjiricky
Hi ,I want to save the image in website folder or server side and path to database for retrieval the image using url. When i click the save btn i going to pass some user details and image path to database using ajax json calling web method i could not able to use server.mappath within page...
6 Jul 2014 by Pravuprasad
you can use below method.System.Web.Hosting.HostingEnvironment.MapPath("path of folder where you want to save image");
23 Jul 2014 by sathishvegeta
pls help us We have built an intranet web-application (that is only used inside the company - so security issues do not matter!). We have several situations, where we have a link in a web-application that should access a local directory on the local file system. When clicking on the link a...
23 Jul 2014 by OriginalGriff
No.It won't work. C# code runs on the Server, not the Client and so any Processes you start with C# will run on teh Server where the user cannot see them.You cannot run applications on the client from C# code except in exceptional circumstances which do not occur in well over 99% of...
24 Jul 2014 by tapasknayak
Here is the error:The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response...
30 Jul 2014 by Torakami
Hii , var ordervalue = $("#" + '').val(); if (ordervalue == '') { $("#" + '').val('asec'); $.ajax({ type: "POST", url:...
3 Aug 2014 by Muhammad Taqi Hassan Bukhari
I am working on my FYP, I have develop a asp.net 4.0 website with ms sql 2012 database. Now next i have to get the MSSQL database as a web service and showed it own android application.I have google it but fund many articles of different categories that is confusing me. Is anyone here had done...
6 Aug 2014 by Muhammad Taqi Hassan Bukhari
I have created a asp.net website and with ms sql server 2012 database and now i want to send that data to android app. How can i do this. i searched on Google and found that this can be done by using web services but confuse in which type of web service? Json,Rest, WCF or anything else.
6 Aug 2014 by Dilan Shaminda
Hi, Web services can be manily devided into two parts. "Big" Web Services and RESTful Web Services. You can read more about them here.you can use either .asmx webservice, WCF or Restful Web service. And JSON is not a web service type. JSON standards for JavaScript Object Notation and it is a...
2 Sep 2014 by Nathan Minier
First, there's an article here:File Upload using jQuery AJAX in ASP.NET Web API[^]Now for backward support for less-modern browsers you'll likely want to include a library that supports file upload on HTML4- browsers, or use an iframe.
9 Sep 2014 by leotato008
Hi guys.Admitting that I'm not familiar with client-side coding..I'm trying to get this ajax call working, but I can't figure it out..function ShowAlert(){ $.ajax( { type: "POST", url: "DownladData.aspx/Alert", data: "{}", contentType:...
10 Sep 2014 by leotato008
Well, I've found the solution to this puzzle.I'll report what I've discovered to help all of the other people.My Ajax/Jquery code was ok.The method must be put in the codebehind of an .aspx page (not sure if it's working even if put behind a master page) and it has to be declared as...
11 Sep 2014 by m-shraddha
I have referred following link :http://www.aspdotnet-suresh.com/2012/03/bind-data-to-gridview-with-jquery-or.html[^]I have written following code in .asmx file and calling this WebMethod in .aspx file using JSON: [WebMethod] public StudentDetails[] GetTodayReport(int...
23 Jun 2017 by jinesh sam
Hai friends i am using jqwidgets plugin to populate table data.my requirement is to display data on table by the combobox selectioni am using asp.netmy problem is how to pass parameter to function “GetCustomersfn(string cusID)”if i use parameter less function ie GetCustomersfn() i get...
13 Sep 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Refer - Send (Pass) multiple parameters to WebMethod in jQuery AJAX POST in ASP.Net[^] and try this technique.Use Json Stringify.
19 Sep 2014 by Hercal
hiiiii ,i hope anyone tell me what's wrong on below code , and why it is not working .webmethod in aspx.cs page . [webmethod] [ScriptMethod(ResponseFormat=ResponseFormat.Json)] public static List GetProblems() { List...
20 Sep 2014 by Suraj Sahoo | Coding Passion
500 Internal Server Error means, it is hitting your server and that is returning the error. My suggestion would be to check the method GetProblems by debugging each step. I guess the return is the problem. Once you debug you will surely resolve that.Thank you. . :)
24 Sep 2014 by Member 9877910
We developed on Project to write an online exam In That I am Getting All questions with Ajax Get Method from sql server database When The candidate Attempting Answers for each question indivudually I am Updating Answer Throw Ajax Post Method .Now when The Candidate attempting...
30 Sep 2014 by ChintanShukla
Web Methods is a good practice but it depends from Application and bussiness requirements. If you add multiple web methods to a single web service class, they will all have just a single URL making it simpler to use. On the client side, when you create a web reference, it will create a separate...
13 Oct 2014 by RAHUL(10217975)
I am working in asp.net development, I have Two files i.e. i) UserControlii).js (javascript)In .js File following is codevar varBindNewSalesTranGrid = '';function BindNewSalesAttribute() { $.ajax({ type: "POST", url: "/url of Webmthod returns string", ...
13 Oct 2014 by RAHUL(10217975)
I am working in asp.net development, I have Two files i.e. i) UserControlii).js (javascript) In .js File following is code var varBindNewSalesTranGrid = '';function BindNewSalesAttribute() { $.ajax({ type: "POST", url: "/url of Webmthod returns string", ...
13 Oct 2014 by Satya Ranjan Sahoo
In the above code you are assigning the value to the global variable inside a ajax call success function. If you look into the steps of execution in $(doument).ready function it first calls the "BindNewSalesAttribute()" function which is asynchronous in nature. Then it executes the...
24 Oct 2014 by RK_Ravindra
how to publish selected methods in web services c# i.e. in my web service there are 3 web method present. I want to handle this method manually like on running web service only web method i choose should be run or published only and rest shouldn't be published. for eg say method1 is selected to...
30 Oct 2014 by laxmikant01
remove below part from form tag and try"action="http://10.19.193.74/unmswebservice/fcc.asmx" method="post""if you are making ajax request which is not hosted on same server you will have to use jsonp as datatypedataType: "jsonp"
11 Nov 2014 by SRS(The Coder)
Simply you can accomplish this using jQuery Ajax very easily :-Let say below is the web method i am having as asmx[WebMethod(EnableSession = true)] public string GetData(int id, string name) { string jsonData = string.Empty; // var data = get data from...
13 Nov 2014 by venkat167
want code for ajax autocomlete textbox , data retrieve from database using web service in asp.net c#.
13 Nov 2014 by DamithSL
check below links Auto complete text box using AJAX (Using Atlas)[^]AJAX AutoCompleteExtender Example in ASP.Net[^]AutoComplete With DataBase and AjaxControlToolkit[^]Auto Complete with jQuery Template Plugin and AJAX[^]previous questions: Auto complete Textbox in asp.net using ajax...
17 Nov 2014 by nimaaamin
hii have :page.cs :public class GetName{ public string Name { get; set; } public string Family { get; set; }} [WebMethod] public List LoadName() { SqlConnection connect = objcon.conect(); List...
17 Nov 2014 by DamithSL
check Bind data to GridView with jQuery or JSON in ASP.Net[^]sample code: public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { BindDummyItem(); } private void BindDummyItem()...
26 Nov 2014 by vonny232
Hi, I am writing a microcontroller project which uses an ethernet controller (with a TCPIP Stack) to send HTTP Post requests.The nature of the project means the number of parameters to be passed to the webmethod will vary (i.e. some of the Parameter names will vary as well as the total...
27 Nov 2014 by ZurdoDev
Yes, passing xml is a perfectly valid way of doing it. Or, the suggestion in the comment is fine too. You can also pass json as well. There are lots of samples online.
30 Nov 2014 by BuBa1947
I have a user control on my web form which is as follows in the following link..http://s8.postimg.org/dmcydrv3p/sample.png[^]I select the program year, category type , category and position group and then click search, it should return a collection which contains the programyearID,...
1 Dec 2014 by footballpardeep
How can i call a webmethod of asp.net page in my anroid app.[WebMethod()] public static string GetHomePageCoupon() { setConnectionString(); List coupons = DataAccesLayer.GetHomePageCoupon(); return...
1 Dec 2014 by jaimin85
add [WebMethod] above method name add using system.web.services name space
3 Dec 2014 by Krunal Rohit
Rather go for WCF RESTful Web Service.See this tutorial.[^]-KR
10 Dec 2014 by Manohar Khillare
in my application i m implement the url rewriting of page. i m using ajax autocomplete extender in my application but it is not working due to page rewrite.i m trying my best to solve the problem but it's not solved.below is my code
24 Dec 2014 by Member 9800875
I have a set of N different URLs as input to my program. I need to check the status code of each of them and generate a report. I am using HttpWebRequest-HttpWebResponse classes of .Net.Also, if I get 5XX status codes I give 'X' times retry attempts to the particular URLs.The problem I...
31 Jan 2015 by BirjuGohel
I have Create a Web ServiceAnd Android Side Upload File (And Video file Part in multiparty and send Android Application Multiparty file and File name )Android Request send two Parameter in asp.net web service,So How to Store Server Folder in Video File Asp.net Web service...
6 Mar 2015 by Peter Leow
Learn to Build RESTful API's with ASP.NET Web API[^]
8 Mar 2015 by Maciej Los
The question is too vague to answer it directly, because you did not provide any information about techniques...I'd suggest to read the documentation:Web Services in Managed Code[^]XML Web Services Created Using ASP.NET and XML Web Service Clients[^]
12 Mar 2015 by thunderboat
how to get weather forecast information for today and tomorrow based on zipcode,city and countries in c#?quick answer
12 Mar 2015 by Abhinav S
Use any existing public API to get this information in an application.Here are a couple of examples -Weather application[^]Using Google Weather API in a C# application[^]
21 Mar 2015 by Sergey Alexandrovich Kryukov
Please see my comment to the question.What I said does not mean that you cannot use someone else's project in your work. I just say that helping you to dig into such projects will hardly be a useful activity in the format of this forum.Of course you can try to do something about it. But...
21 Mar 2015 by Sergey Alexandrovich Kryukov
Why not? What steps? Of course you can re-create a solution. I answered here: Want to take WebService related file in a solution...[^].Please don't re-post questions.—SA
23 Mar 2015 by Member 4228925
I was trying to create a web service in Dotnet framework 4.0 but i dont find any option. Can anyone help?
23 Mar 2015 by King Fisher
It has a solution , He said it is outdatedRefer this Solution,http://stackoverflow.com/questions/9691909/where-did-asp-net-web-service-go-in-net-framework-4-0[^]
26 Mar 2015 by Sudhansu Sekhar Prusty
Steps :1: Solution -> Set StartUp projects -> Choose "Multiple project" (and select both Web and Service)2: Service project -> Properties -> Web -> Choose "Dont open a page, wait for an external request".3: Web Project -> Properties -> Web-> choose current page or StartPage as your...
30 Mar 2015 by Member 10874581
i am making a webmethod in webservice the mathod fetch student details after submiting value in textbox to server but i am getting error.my webmethod is [WebMethod] public stu viks( int id) { string str =...
5 May 2015 by Torakami
Hi , My question is that , i previously using static property which contains drop down value present in drop down . And i was trying to access this value from user controls parent page from Web method. As web method requires static fields only to get the value .But i am in chaos...
5 May 2015 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
While using WebMethods, you need to mark that method as Static. That is done because the method call does not instantiate the Page Class, which happens with normal Page PostBacks. That is the actual benefit of Ajax Calls. More at - Why do ASP.NET AJAX page methods have to be static?[^].Why...
8 May 2015 by OriginalGriff
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...A very quick search using your subject as the search term gave nearly 3/4 of a million hits: Google[^]In future, please try to do at least basic research yourself, and...
8 May 2015 by Sergey Alexandrovich Kryukov
This is more about Web scraping, not crawlers: http://en.wikipedia.org/wiki/Web_scraping[^].Please see my past answers:Performing a some kind of Web Request and getting result[^],get specific data from web page[^],How to get the data from another site[^].—SA
15 May 2015 by bhavikadb
hello,How to bind Repeater in WebMethod?
26 May 2015 by User 8696850
Hello,I need to create a complex web service searching on internet i have found something like that : @POST @Path("functionname") @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) @Produces(MediaType.APPLICATION_JSON) public String...
11 Aug 2015 by Member 11072126
Hello All,I am using jquery ajax to populate a whole form on selection of an item. The form contains 4-5 dropdown lists and 3 checkbox list and few textboxes. So, I planned to bind the values using c# from code behind instead of writing fucntions in jquery itself for each dropdowns / The...
11 Aug 2015 by harshil gandhi
i need a code to call a javascript function from my static webmethod.plz help.......thanks in advance [System.Web.Services.WebMethod] public static string password(string UserId, string UserName, string Password, string ConPassword, string EmailId, string Country, string...
13 Aug 2015 by Andy Lanng
"Binding" is server side. The actual control will take the data from the source and write out the html during the controls "RenderChildren(HtmlWriter writer)" method.If you want to perform this client-side, then you will have to replicate the effect.Take a look at the html source on...
19 Aug 2015 by Member 11922091
Bind Dropdownlist with JQuery in asp.net