Click here to Skip to main content
15,893,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
right now i am using a pagination concept in my application to show data in grid view. Now i want a view more button so that while user press it next 10 columns should appear under first 10 columns on the same page. like facebook view more. please help me
Posted
Comments
Dinesh Mani 28-Mar-12 3:01am    
I assume your "View More" button is not related to the page nos. Just have the gridview properties reset to what ever page size that you need and rebind the data.

The ambiguity that I foresee here is that when the user is on page 4 with 10 records in 1 page, what should the grid display now? records 31 to 50 or 61 to 80??

1 solution

Hi Betu,


This can be done by 2 ways:

1> you can add drop down with list of number of rows you want to show in grid view.

In this as per user selection you can set page size to grid view.


2> as you want to show button, then on every time button click increase page size by specific number i.e 10


Try this.

All the Best !!!
 
Share this answer
 
Comments
betu.009 28-Mar-12 3:51am    
<asp:GridView ID="GridView1" runat="server" Width="600px" PageSize="5" AllowPaging="true"
CellPadding="8" CellSpacing="2"
PagerStyle-BorderStyle="None" GridLines="None" AutoGenerateColumns="False"
RowStyle-Height="2px" HeaderStyle-Height="2px" OnRowDataBound="GridView1_RowDataBound">
this is my grid view .aspx code and




this is the code of next button in .cs file


protected void viewmore_Click(object sender, ImageClickEventArgs e)
{
int i = GridView1.PageSize;
i = i + 2;
GridView1.PageSize = i;
// GridView1.DataSource = dt;

GridView1.DataBind();
}


but when i click on next button grid view disappears.
betu.009 28-Mar-12 3:59am    
its done..thanks

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