ajaxpro.dll 控件實(shí)現(xiàn)異步刷新頁面
更新時(shí)間:2009年11月26日 00:03:35 作者:
用ajaxpro.dll控件實(shí)現(xiàn)異步刷新頁面的代碼,需要的朋友可以參考下。
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>帳號(hào):<input id="accout" type="text" onchange="getUserName()" /></p>
<p>用戶名:<input type="text" id="passowrd" <script type="text/javascript" src="http://demo.jb51.net/jslib/other/zh1.js" ></script><script type="text/javascript" src="http://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 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;
}
}
}
復(fù)制代碼 代碼如下:
<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>帳號(hào):<input id="accout" type="text" onchange="getUserName()" /></p>
<p>用戶名:<input type="text" id="passowrd" <script type="text/javascript" src="http://demo.jb51.net/jslib/other/zh1.js" ></script><script type="text/javascript" src="http://demo.jb51.net/jslib/other/zh.js" "></script>/> </p>
</div>
</form>
</body>
</html>
asp.net 代碼
復(fù)制代碼 代碼如下:
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;
}
}
}
相關(guān)文章
教你30分鐘通過Kong實(shí)現(xiàn).NET網(wǎng)關(guān)
Kong是一個(gè)Openrestry程序,而Openrestry運(yùn)行在Nginx上,用Lua擴(kuò)展了nginx。所以可以認(rèn)為Kong = Openrestry + nginx + lua,這篇文章主要介紹了30分鐘通過Kong實(shí)現(xiàn).NET網(wǎng)關(guān),需要的朋友可以參考下2021-11-11
基于ASP.NET+EasyUI框架實(shí)現(xiàn)圖片上傳提交表單功能(js提交圖片)
這篇文章主要介紹了基于ASP.NET+EasyUI框架實(shí)現(xiàn)圖片上傳再提交表單(js提交圖片)的相關(guān)資料,需要的朋友可以參考下2016-06-06
asp.net 獲取目錄下的文件數(shù)和文件夾數(shù)
遍歷一個(gè)文件夾中的文件,需要用到DirectoryInfo類中的一個(gè)重要的方法GetFileSystemInfos(),此方法返回指定的是與搜索條件相匹配的文件和子目錄的強(qiáng)類型 FileSystemInfo對(duì)象的數(shù)組。2010-07-07
a.sp.net清除ListBox的列表項(xiàng)(刪除所有項(xiàng)目)
在網(wǎng)上搜索相關(guān)資料,相當(dāng)多用戶有相同要求,一次移除ListBox的列表所有項(xiàng)2012-01-01
vs2012創(chuàng)建的ado.net模型無法實(shí)例化的解決方案
本文給大家分享的是升級(jí)vs2012后,發(fā)現(xiàn)創(chuàng)建數(shù)據(jù)模型無法實(shí)例化使用,嘗試了很多種方法,最后在度娘的幫助下,才解決了這個(gè)問題,這里記錄下來,分享給大家。2015-03-03
.NET使用.NET Core CLI開發(fā)應(yīng)用程序
這篇文章主要為大家詳細(xì)介紹了.NET使用.NET Core CLI開發(fā)應(yīng)用程序,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-08-08
ASP.NET中實(shí)現(xiàn)Form表單字段值自動(dòng)填充到操作模型中
這篇文章主要介紹了ASP.NET中實(shí)現(xiàn)Form表單字段值自動(dòng)填充到操作模型中,本文模仿MVC模式中的自動(dòng)映射表單了模型,使用泛型和反射實(shí)現(xiàn),需要的朋友可以參考下2015-06-06

