Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 30-Mar-12 0:41am
v2

 
Share this answer
 
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...


C#
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"]);

  }
  
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900