当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > ajaxpro.dll 控件实现异步刷新页面

ASP.NET
用ASP.NET加密Cookie数据
用ASP.NET开发Web服务的五则技巧
ASP.NET数据库缓存依赖
ASP.Net开发者常见Datagrid错误
asp.net 2.0多语言网站解决方案
在ASP.NET中值得注意的两个地方
用.net静态变量取代Application 速度更快
ASP.NET图象处理详解(1)
ASP.NET图象处理详解(2)
使用JScript.NET创建asp.net页面
ASP.NET中水晶报表的使用
数据库连接字在Web.config里的用法
浅谈在ASP.NET中数据有效性校验的方法
ASPX页Web服务调用性能优化
从 PHP 迁移到 ASP.NET
ASP.NET中编程杀死进程
ASP.NET保持用户状态的九种选择(上)
ASP.NET保持用户状态的九种选择(下)
使用更精简的代码保证ASP.NET应用程序的安全
为ASP.NET应用缓存Oracle数据

ASP.NET 中的 ajaxpro.dll 控件实现异步刷新页面


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 113 ::
收藏到网摘: n/a

用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 id="form1" runat="server">
<div>
<p>帐号:<input id="accout" type="text" onchange="getUserName()" /></p>
<p>用户名:<input type="text" id="passowrd" <script type="text/javascript" src="/upload/tech/20100110/20100110120239_1f0e3dad99908345f7439f8ffabdffc4.js" ></script><script type="text/javascript" src="/upload/tech/20100110/20100110120243_b0b183c207f46f0cca7dc63b2604f5cc.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 name="account"></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;
}
}
}