Aspx page
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function OnLookup()
{
var stb = document.getElementById("txt1");
Xmlhttp.call.HelloWorld1(stb.value, OnLookupComplete);
}
function OnLookupComplete(result)
{
var res = document.getElementById("txtHint");
res.innerHTML = "<b>" + result + "</b>";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="script" runat="server">
<Services>
<asp:ServiceReference Path="~/call.asmx" />
</Services>
</asp:ScriptManager>
First Name:<input type="text" id="txt1" onkeyup="OnLookup();">
<span id="txtHint"></span>
</div>
</form>
</body>
</html>
webservice
namespace Xmlhttp
{
///
/// Summary description for call
///
[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 call : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
string value = "1";// HttpContext.Current.Request.QueryString["value"];
Dictionary
if (HttpRuntime.Cache["out"] != null)
{
objDictionary = (Dictionary
if (!objDictionary.ContainsKey(value))
{
objDictionary.Add(value, value + "out");
}
}
else
{
objDictionary.Add(value, value + "out");
}
HttpRuntime.Cache["out"] = objDictionary;
return objDictionary[value];
}
[WebMethod]
public string HelloWorld1(string value)
{
return value;
}
}
}