Solved

web service call server side

Posted on 2013-10-22
3
296 Views
Last Modified: 2013-11-28
Hi Experts,

I have a simple <input id="mybutton" runat="server" onserverclick="callwebservice" type="button"/>
I would need example in cs file to call my asmx web service and get result in the same
cs class.

I am working in 4.0 C# framework.

Thanks.
0
Comment
Question by:fpoyavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
Srihari03 earned 500 total points
ID: 39591720
Sample Button .aspx page:

 <div>
        <input id="mybutton" value="CallWebService" runat="server" onserverclick="callwebservice" type="button"/>
    </div>

Snippet in .cs file:


protected void callwebservice(object sender, EventArgs e)
        {
            ExpertSamples.SampleWS sampleWS = new SampleWS();
            Response.Write(sampleWS.HelloWorld());  
        }
0
 
LVL 10

Expert Comment

by:Monica P
ID: 39593950
Firstly create an Object to access the your asmx file main class

Using the Object reference the webmethod in your asmx file.

Read the response and based on that make your logic works
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 39593982
May you provide working example?
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question