首页 > 编程知识 正文

分页功能,前后端是如何交互的(qtableview分页显示)

时间:2023-05-04 04:14:44 阅读:68999 作者:3564

实现GridView寻呼功能的四个重要步骤

1、设置AllowPaging='True '

2、PageSize=设定每页的记录数。

3、寻呼事件OnPageIndexChanging=设置寻呼事件;此示例中的分页事件被命名为:Page_Change

前三个步骤具体为以下示例中的蓝色部分。

ASP : GridView id=' GridView1' runat=' server ' autogenerate columns=' false '

onrowcommand=' grid _ row _ com ' allowpaging=' true '

pagesize='5' onpageindexchanging=' page _ change '

4、编辑分页活动。

(1)、设置GridView.pageIndex属性;

) 2、重新绑定GridView数据源。

protectedvoidpage _ change (对象发送器,GridViewPageEventArgs e ) )。

{

GridView1. page index=e.new page index;

My_DataBind (;

}

其中:My_DataBind ()是此页的数据绑定函数。 具体如下。

protectedvoidpage _ load (对象发送器,事件发生器) ) ) ) ) ) ) ) )。

{

if (! IsPostBack )

{

My_DataBind (;

}

}

保护性void my _ databind (

{

string my _ constring=configuration manager.appsettings [ ' db _ tome1connectionstring ' ];

sqlconnection my _ con=new sqlconnection (my _ constring;

string my _ sel=' select * fromtb _ goods info ';

sqldataadaptermy _ ada=newsqldataadapter (my _ sel,My_Con );

DataSet My_Set=new DataSet (;

my_ada.fill(my_set,' Mytable ';

GridView1. data source=my _ set.tables [ ' my table ' ];

GridView1. datakeynames=new string [ ] { ' goods id ' };

GridView1.DataBind (;

My_Con.Close (;

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。