Click here to Skip to main content
12,759,231 members (32,739 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
Hi,
in portal I search by job "asp.net" and 10jobs listed in gridview then i click first job to view the Job details(viewjob.aspx).
How to use move next previous in viewjob?

For ex we will see that in gmail. we click email then view details in that same page we can see next email without go back to inbox.

Thasnks in advance.
Posted 17-Dec-12 0:08am
24983793
Updated 17-Dec-12 0:19am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

if ur question is regarding gridview paging then set the allowing paging property as true. u will get next and prev button automatically and wirte the functionality in "pageindexchanging event" or if u want to continue the paging functionality using outside buttons then here is the example given below.
public partial class _Default : System.Web.UI.Page
{
static SqlConnection cn = new SqlConnection("server=DEVAPP;user id=sa;password=sa123;database=test");
protected void Page_Load(object sender, EventArgs e)
{
getdata();
}
public void getdata()
{
SqlDataAdapter da = new SqlDataAdapter("select * from employee", cn);
DataSet ds = new DataSet();
da.Fill(ds, "emp");
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void prev_Click(object sender, EventArgs e)
{
if (GridView1.PageIndex > 0)
{
GridView1.PageIndex = GridView1.PageIndex - 1;
getdata();
}
}
protected void next_Click(object sender, EventArgs e)
{
GridView1.PageIndex = GridView1.PageIndex + 1;
getdata();
}
}
  Permalink  
v2
Comments
santhosh19783 17-Dec-12 5:50am
   
thanks Rohit...but do u see gmail inbox in that we click email in inbox then view Details same time Previous and next at top right this is based on inbox list (Ex:< >)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You will have to fire a query to return the result plus a column for row number. Use Row_Number() function of SQL Server for this. When moving to the details page for the selected record, pass the row number also (client side or server side). on click of next or previous buttons, you can run the same query that you used to bind the gridview and based on the row number you can show the selected record.
  Permalink  

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

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100