Solved

web service call server side

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

How our DevOps Teams Maximize Uptime

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

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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