b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

vs gridview分页_gridview分页_vs gridview边框颜色(3)

电脑杂谈  发布时间:2017-02-04 13:31:13  来源:网络整理

<SortedDescendingCellStyle BackColor="#FCF6C0" />

<SortedDescendingHeaderStyle BackColor="#820000" />

</asp:GridView>

PageSize="4"

PagingButtonSpacing="2px" AlwaysShow="True" ShowBoxThreshold="1"CurrentPageButtonPosition="Beginning" ShowMoreButtons="False"

onpagechanged="AspNetPager1_PageChanged">>

</webdiyer:AspNetPager>

</div>

</form>

</body>

</html>

后台代码如下:

using System;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Data;

using System.Data.SqlClient;

namespace fenye2

{

public partial class fenye21 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

dobind();

}

}

public void dobind()

{

SqlConnection cnn = new SqlConnection("Data Source=.;Initial Security=True");

string sql = "select * from Info ";

SqlDataAdapter sda = new SqlDataAdapter(sql,cnn);

DataSet ds = new DataSet();

sda.Fill(ds,"Info");

PagedDataSource pds = new PagedDataSource();

pds.DataSource = ds.Tables["Info"].DefaultView;

AspNetPager1.RecordCount = pds.Count;

// AspNetPager1.RecordCount = ds.Tables["Info"].DefaultView.Count;pds.PageSize = AspNetPager1.PageSize;

GridView1.PageIndex = AspNetPager1.CurrentPageIndex - 1;

this.GridView1.DataSource = pds;

this.GridView1.DataBind();

}

protected void AspNetPager1_PageChanged(object sender, EventArgs e){

dobind();

}

}

}

希望可以对初学者有帮助 Catalog=Stu;Integrated


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-30496-3.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...