Solved

web service call server side

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now