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

ASP.NET
ASP.NET动态创建控件之绝境求生
客户端回调实现gridView无刷新分页
ASP.NET2.0中将文件上传到数据库
ASP.NET2.0轻松搞定统计图表
asp.net ajax 使用updatepanel更新后的提示
Asp.Net对Xml文件的操作
Asp.net 远程抓取,分解,保存,匹配
ASP.NET 中处理页面“回退”的方法
ASP.NET 2.0中轻松实现网站换肤
C#+ASP.NET 2.0 定制复合组件之基础篇
C#+ASP.NET 2.0 定制复合组件之高级篇
ASP.NET 2.0 服务器控件之复合控件事件
在Apache上调试ASP.NET 1.1/2.0代码
ASP.NET中的DataGrid的属性
动态的管理ASP.NET DataGrid数据列
ASP.NET网站程序预防SQL注入式攻击策略
Windows下SVN配置和apache的配置
.NET事件处理的过程
ASP.net技术:AJAX实现留言板信息展开
三代IIS下ASP.net请求处理过程

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 105 ::
收藏到网摘: 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;
}
}
}