ajaxpro.dll 控件实现异步刷新页面

用ajaxpro.dll控件实现异步刷新页面的代码,需要的朋友可以参考下。

html代码

复制代码 代码如下:


<script type="text/javascript"><!--
function getUserName()
{
Demo.ajax.GetUserName(document.getElementById("accout").value,getName);
}
function getName(respone)
{
document.getElementById("passowrd").value=respone.value;
}
// --></script>
</head>
<body>
<form runat="server">
<div>
<p>帐号:<input type="text" onchange="getUserName()" /></p>
<p>用户名:<input type="text" <script type="text/javascript" src="https://demo.jb51.net/jslib/other/zh1.js" ></script><script type="text/javascript" src="https://demo.jb51.net/jslib/other/zh.js" "></script>/> </p>
</div>
</form>
</body>
</html>



asp.net 代码

复制代码 代码如下:


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace Demo
{
public partial class ajax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(ajax));
}
/// <summary>
/// 获取用户名
/// </summary>
/// <param></param>
/// <returns></returns>
[AjaxPro.AjaxMethod]
public string GetUserName(string account)
{

string ok = (string)SqlHelper.ExecuteScalar(SqlHelper.connectionString, CommandType.Text, "select account from users where account='" + account + "'");
return ok;
}
}
}

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjjpdd.html