Hi,
 
I am trying to call webservice method to get the string, but nothing happening, it wont display it in the label.
Can u help?? plz
 
 using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
using System.Web.Services;
namespace WebService
{
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    
    //[System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {
      
        [WebMethod]
        public string GetCurrencyRate(string FromCurrencyCode, string ToCurrencyCode)
        {
            string Rate = "";
            //Create connection
            SqlConnection con = new SqlConnection(@"Data Source=Comp1;Initial Catalog=CurrencyExchange;Integrated Security=True;");
            //Instantiate connection
            SqlDataReader rdr = null;
            try
            {
                
                con.Open();
              
                SqlCommand cmd = new SqlCommand("spGetRate", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@FromCurrencyCode", SqlDbType.Char)).Value = FromCurrencyCode;                
                cmd.Parameters.Add(new SqlParameter("@ToCurrencyCode", SqlDbType.Char)).Value = ToCurrencyCode; 
              
                rdr = cmd.ExecuteReader();
              
                while (rdr.Read())
                {
                   Rate = rdr["Rate"].ToString();
                }
                //Close Connection
                rdr.Close();
                con.Close();
                return Rate;
            }
            
            finally
            {
             
                if (rdr != null)
                {
                    rdr.Close();
                }
             
                if (con != null)
                {
                    con.Close();
                }
            }
            
        }
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebService
{
    public partial class Dafault : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            localhost.Service1 CallWebService = new localhost.Service1();
            string sGetValue = CallWebService.GetCurrencyRate(ddlFromCurrency.SelectedItem.Text, ddlToCurrency.SelectedItem.Text);
            lbDisplay.Text = sGetValue;
   
        }
    }
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebService.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:DropDownList ID="ddlFromCurrency" runat="server" DataSourceID="ObjectDataSource1" DataTextField="CurrencyName" DataValueField="CurrencyName">
        </asp:DropDownList>
        <asp:DropDownList ID="ddlToCurrency" runat="server" DataSourceID="ObjectDataSource1" DataTextField="CurrencyName" DataValueField="CurrencyName" Height="16px">
        </asp:DropDownList>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="LoadCurrency" TypeName="WebService.Service1"></asp:ObjectDataSource>
        <br />
        <br />
           <br />
        <br />
        <br />
        
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        <br />
        <br />
        <asp:Label ID="lbDisplay" runat="server"</asp:Label>
    
        <br />
        <br />
        <div id="output">
        </div>
        </div>
    </form>
</body>
</html>