<HTML>
<HEAD>
<title>AjaxForm</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="
http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function testAjax(owner, item, evt)
{
var first=document.getElementById("txtfirst");
AjaxMethod.GetNIVNumber(first.value,callback_GetNIVNumber);
}
function callback_GetNIVNumber(res)
{
var obj=document.getElementById("txtsecond");
obj.value=res.value;
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<INPUT style="Z-INDEX: 101; LEFT: 208px; POSITION: absolute; TOP: 40px" type="button" value="Button"
onclick="testAjax();">
<asp:TextBox id="txtfirst" style="Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 40px" runat="server"></asp:TextBox>
<asp:TextBox id="txtsecond" style="Z-INDEX: 103; LEFT: 40px; POSITION: absolute; TOP: 72px" runat="server"></asp:TextBox>
</form>
</body>
</HTML>protected System.Web.UI.WebControls.TextBox txtfirst;
protected System.Web.UI.WebControls.TextBox txtsecond;
private void Page_Load(object sender, System.EventArgs e)
{
//注冊,其中Document.Pages.AjaxTest.AjaxMethod為AjaxMethod.cs方法所在的命名空間
Ajax.Utility.RegisterTypeForAjax(typeof(Document.Pages.AjaxTest.AjaxMethod));
}