C#2.0下用Ajax无刷新快速分页例子(一)

首先把AjaxPro.dll文件添加到引用中,可以到http://www.schwarz-interactive.de/下载 根据你的.net 版本来选择不同的DLL文件.
default.aspx.cs:
public partial class _Default : System.Web.UI.Page
{
    string connectString = "";//定义自已的连接串    
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));
    }
    [AjaxPro.AjaxMethod]
    public DataTable GetDataTable()
    {
        SqlDataAdapter ad = new SqlDataAdapter("select * from tableName", connectString);
        DataSet ds = new DataSet();
        ad.Fill(ds);
        int num = ds.Tables[0].Rows.Count;
        return ds.Tables[0];
    }
}
posted on 2006-08-22 10:21  自由.Net  阅读(1026)  评论(4编辑  收藏  举报