GridView分页问题 在线等
public partial class Manage_AdminNews : System.Web.UI.Page
{
BaseClass bc = new BaseClass();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridView1_Bind();
}
}
protected void GridView1_Bind()
{
GridView1.DataSource = bc.GetDateSet("select ID,NewsTitle,AddTime from News order by UPDateTime desc", "News");
GridView1.DataKeyNames = new string[] { "ID" };
GridView1.DataBind();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
}
}
------解决方案--------------------protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}
GridView1.DataBind(); 这个方法改成GridView1_Bind() ;
------解决方案--------------------没看出哪错误,提示什么错误啊?
------解决方案--------------------第一页也没有数据?