Solved

web service call server side

Posted on 2013-10-22
3
289 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

740 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