asp.net 中gridview每页显示8条数据怎么做?就改一下pagesize就行了吗?我改了怎么不行啊?

前台代码:<asp:GridViewID="GridView1"runat="server"AutoGenerateColumns="False"CellPadding=... 前台代码:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="Both">
<Columns>
<asp:BoundField DataField="Anumber" HeaderText="员工编号" ReadOnly="True" />
<asp:BoundField DataField="employeename" HeaderText="员工姓名" />
<asp:BoundField DataField="date" HeaderText="日期" />
<asp:BoundField DataField="worktime" HeaderText="正班工时" />
<asp:BoundField DataField="overtime" HeaderText="加班工时" />
<asp:BoundField DataField="absentwork" HeaderText="矿工天数" />
<asp:BoundField DataField="late" HeaderText="迟到分钟" />
<asp:BoundField DataField="askleave" HeaderText="请假天数" />
</Columns>
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>

.cs中的代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["manageConnectionString"].ConnectionString);
con.Open();
string sqlstr3 = "select name from sysobjects where xtype='U ' and name<>'sysdiagrams' and name<>'manager' order by name";
SqlDataAdapter myada3 = new SqlDataAdapter(sqlstr3, con);
DataSet myds3 = new DataSet();
myada3.Fill(myds3);
DropDownList1.DataSource = myds3.Tables[0];
DropDownList1.DataValueField = "name";
DropDownList1.DataBind();
}
}
protected void Button1_Click1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["manageConnectionString"].ConnectionString);
con.Open();
string sqlstr4 = "select * from " + DropDownList1.SelectedValue;
SqlDataAdapter myada4 = new SqlDataAdapter(sqlstr4, con);
DataSet myds4 = new DataSet();
myada4.Fill(myds4);
this.GridView1.DataSource = null;
this.GridView1.DataSource = myds4.Tables[0];
this.GridView1.DataBind();
}
展开
 我来答
秋字有意思
2011-11-01
知道答主
回答量:15
采纳率:0%
帮助的人:7.5万
展开全部
设置GridView1的属性:AllowPaging="True"
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式