GridView的动态分页 [英] dynamic paging of gridview

查看:99
本文介绍了GridView的动态分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用于输入学生分数的gridview,我的gridview正在分页,我需要的是当我移到gridview的页面2到页面1的链接时,即后页应该被禁用,这意味着不应有任何内容在gridview中返回导航.

请给我建议...........
谢谢你"

改进了..问题-----------

我认为我的问题不清楚,这里根本不是在谈论浏览器的上一页,而是在Gridview的页面上说1,2,3,所以我想当我移至页面2时应禁用"1",这意味着用户不应单击2后可以转到第1页.

I have gridview which am using to enter marks of student, My gridview is having paging , what i need is when i move to page 2 of gridview link to page 1 i.e back page should be disable, means there should not be any back navigation in gridview.

Plz suggest me...........
"Thanking you"

improved..question-----------

I Think my question was not clear, here am not at all talking about browser page back rather page of Gridview say 1,2,3, so i want when i move to page 2 then "1" should be disable, means user should not be able to go page 1 after he click on 2.

推荐答案

请参阅此讨论

您需要指定您希望在每个网格中显示的结果集的上限和下限...
为此,请定义三个容器变量(基于您的环境),并使用它们来仅将您需要的那些变量查询记录到DB

ASP.Net环境的示例将像这样...


You need to specify the upper and lower limit for the results set you wish to display in each grid show...
for that purpose define three container variables (based upon your environment) and use them to query records to DB only those you require

example for ASP.Net environment will be somehow like this...


inside webpage define two hidden fields or add two values in session (based on your choice)
 
i.e 
Class YourClass
{
  int gridSize = 20;
  public void Page_OnLoad(object sender, EventArgs e)
  {
    if ( (int)Session["LowerLimit"] == null))
      Session["UpperLimit"] = gridSize; Session["LowerLimit"] = 0; 
    
    string yourCommand = "Select a.Col1, a.Col2, a.ColN From yourTable a
                          WHERE a.ID 
                          BETWEEN" + Session["LowerLimit"] + 
                          " AND " + Session["UpperLimit"];
     
//Execute your command and get data in dataAdapter.Fill(dataSet);

//Update Session Records Value
//Session["LowerLimit"] = Session["UpperLimit"];
//Session["UpperLimit"] = ((int)Session["UpperLimit"]) + ((int)Session["UpperLimit"]);

  }
  
}


这篇关于GridView的动态分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆