Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 16-Dec-12 23:19pm
v2

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.
C#
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();
}
}
 
Share this answer
 
v2
Comments
24983 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:< >)
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.
 
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