gridview分页不显示数据 10
aspx.cs中如下:publicvoidgetList(stringsql)//将满足sql语句的数据绑定到GridView{DataTabledt=GetDataTa...
aspx.cs中如下:
public void getList(string sql) //将满足sql语句的数据绑定到GridView
{
DataTable dt = GetDataTable(sql);
GrvList.DataSource = dt;
GrvList.DataKeyNames = new string[] { "Id" };
GrvList.DataBind();
}
protected void GrvList_PageIndexChanging(object sender, GridViewPageEventArgs e) //实现GridView的分页
{
GrvList.PageIndex = e.NewPageIndex;
getList(sql);
}
protected void GrvList_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
string stuName = (string)Session["UserName"];
int stuId = Convert.ToInt32(Session["StuId"]);.....
aspx如下:
<asp:GridView ID="GrvList" runat="server" CssClass="table2" AllowPaging="True" AutoGenerateColumns="False" PageSize="6" OnPageIndexChanging="GrvList_PageIndexChanging"
OnSelectedIndexChanging="GrvList_SelectedIndexChanging" Visible="False"> <Columns>..... 展开
public void getList(string sql) //将满足sql语句的数据绑定到GridView
{
DataTable dt = GetDataTable(sql);
GrvList.DataSource = dt;
GrvList.DataKeyNames = new string[] { "Id" };
GrvList.DataBind();
}
protected void GrvList_PageIndexChanging(object sender, GridViewPageEventArgs e) //实现GridView的分页
{
GrvList.PageIndex = e.NewPageIndex;
getList(sql);
}
protected void GrvList_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
string stuName = (string)Session["UserName"];
int stuId = Convert.ToInt32(Session["StuId"]);.....
aspx如下:
<asp:GridView ID="GrvList" runat="server" CssClass="table2" AllowPaging="True" AutoGenerateColumns="False" PageSize="6" OnPageIndexChanging="GrvList_PageIndexChanging"
OnSelectedIndexChanging="GrvList_SelectedIndexChanging" Visible="False"> <Columns>..... 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询