|
大家好,这篇文章承启上一篇文章《ASP.NET分页组件学与用——教学篇》。
在《ASP.NET分页组件学与用——教学篇》中,我们讲解了分页组件的整个创建过程,那么在这一篇文章中,我们主要讨论一下如何使用该组件。
请按以下步骤操作:
1、 创建一个WEB应用程序工程。
2、 将上篇文章中生成的组件添加到工具箱中。如果您不知道添加的过程,请参考文章《ASP.NET组件编程step by step》
3、 在默认的WEB窗体页面中,切换到HTML视图,把下列HTML代码复制到<form>标签中。
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="756" height="155" style="FONT-SIZE:12px">
<tr>
<td width="756" height="23">分页控件的使用实例</td>
</tr>
<tr>
<td width="756" height="110" valign="top" align="center" runat="server" id="myHtml"></td>
</tr>
<tr>
<td width="756" height="22">
</td>
</tr>
</table>
</center>
</div>
4、 该HTML代码生成一个三行一列的表格,从工具箱将控件拖到该表格的第三行中。
5、 在private void Page_Load(object sender, System.EventArgs e)事件处理程序中添加如下代码:
int cp;
if(this.Request.Params["currentPage"] == null)
{
cp = 1;
}
else
{
cp = Convert.ToInt32(this.Request.Params["currentPage"]);
}
SqlConnection con = new SqlConnection("server=accp-lzh;uid=sa;pwd=sasa;database=Northwind");
SqlCommand cmd = new SqlCommand("select * from [Order Details]",con);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = cmd;
  [1] [2] 下一页 [C语言系列]NET 中C#的switch语句的语法 [系统软件]托拽Explore中的文件到VB.net的窗口 [系统软件]Boost库在XP+Visual C++.net中的安装 [常用软件]新配色面板:Paint.Net3.0RC1官方下载 [常用软件]用内建的“Net Meeting”聊天 [VB.NET程序]Henry的VB.NET之旅(三)—共享成员 [VB.NET程序]Henry的VB.NET之旅(二)—构造与析构 [VB.NET程序]Henry的VB.NET之旅(一)—失踪的窗体 [VB.NET程序]在托盘上显示Balloon Tooltip(VB.NET) [VB.NET程序]Henry手记-VB.NET中动态加载Treeview节点(二)
|