语句的作用:页面注册方法的作用。
AjaxPro.Utility.RegisterTypeForAjax(typeof(命名空间.类名));
Default.aspx.cs
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e) {
AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));
}
[AjaxPro.AjaxMethod]
public int result(String Types) {
if (Types!="") {
return 1
}
else {
return 0;
}
}
<script language="javascript">
function checkUserName()
{
var userName=document.getElementById('Text1').value;
if (_Default.result(userName).value="-1")
{
info.innerHTML="Error";
}
return false;
}
<input id="Text1" type="text" οnfοcusοut="return checkUserName()" />