so it will be looking like this:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Script.Services
Imports WebControlLibrary
Imports Ubill.Business
Imports System.ComponentModel
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> <System.Web.Script.Services.ScriptService()> _
Public Class AtlasHub
Inherits System.Web.Services.WebService
<WebMethod(True)> _
Public Function AdvanceCustomerDelete(ByVal CustomerID As String) As String
Return cachefactory.AdvanceCustomerDelete(CustomerID)
End Function
End Class
2.On aspx page add this script manager binding :
<asp:ScriptManager runat="server" ID="scriptManagerId">
<Scripts>
<asp:ScriptReference Path="~/common/AtlasHub.js" />
</Scripts>
<Services>
<asp:ServiceReference Path="~/common/AtlasHub.asmx " />
</Services>
</asp:ScriptManager>
3.AtlasHub.js is javascript file those contains maintenance functions:
// Business functions
// // -------------------------------------------
function AdvanceCustomerDelete( customerID , onSuccessAdvanceCustomerDelete){
YouBillWeb.AtlasHub.AdvanceCustomerDelete(customerID,onSuccessAdvanceCustomerDelete,onTimeOut,onFailed);
}
// Maintenance functions
// -------------------------------------------
// This is the callback function invoked if the Web service
// succeeded.
// It accepts the result object, the user context, and the
// calling method name as parameters.
function OnSucceededWithContext(result, userContext, methodName)
{
var output;
// Page element to display feedback.
var RsltElem = document.getElementById("ResultId");
var readResult;
if (userContext == "XmlDocument")
{
if (document.all)
readResult =
result.documentElement.firstChild.text;
else
// Firefox
readResult =
result.documentElement.firstChild.textContent;
RsltElem.innerHTML = "XmlDocument content: " + readResult;
}
}
// This is the callback function invoked if the Web service
// succeeded.
// It accepts the result object as a parameter.
function onSuccess(result, eventArgs)
{
// Page element to display feedback.
var RsltElem = document.getElementById("ResultId");
RsltElem.innerHTML = result;
}
function OnSucceeded(result, eventArgs)
{
// Page element to display feedback.
var RsltElem = document.getElementById("ResultId");
RsltElem.innerHTML = result;
}
// This is the callback function invoked if the Web service
// failed.
// It accepts the error object as a parameter.
function onFailed(error)
{
// Display the error.
var RsltElem = document.getElementById("ResultId");
RsltElem.innerHTML =
"Service Error: " + error.get_message();
}
function onTimeOut(error)
{
// Display the error.
var RsltElem = document.getElementById("ResultId");
RsltElem.innerHTML =
"Service Error: " + error.get_message();
}
if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
more...
No comments:
Post a Comment