Solved

Custom Paging on GridView using C#.net

Posted on 2011-03-17
4
587 Views
Last Modified: 2012-05-11
Hi,

By default, I am displaying data in a Grid with PagerSettings( i.e allowing paging)
Default, CheckBox1 is not checked.
Now, upon CheckBox1 checked, i want to remove the pagerSettings and display all the rows in single page .

again , if Checked i want to apply the paging again(like First,Last,Previous..) and pageSize=10

How can i accomplish using C#.net
0
Comment
Question by:kishan66
4 Comments
 
LVL 7

Accepted Solution

by:
nbove earned 400 total points
ID: 35161326
1) Set the AutoPostBack property to "True" on the checkbox
2) In the "CheckChanged" event of the checkbox add the following code:
myGrid.AllowPaging = !CheckBox1.Checked
0
 
LVL 13

Expert Comment

by:agarwalrahul
ID: 35162340
0
 
LVL 6

Assisted Solution

by:nandithaa
nandithaa earned 100 total points
ID: 35162645
U can do like this:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        //bindGridView();
    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        GridView1.AllowPaging = CheckBox1.Checked;
    }

Open in new window

0
 

Author Comment

by:kishan66
ID: 35165477
reason for giving less points  --- Solution is not complete..had to call loadGrid and DataBind too.
thanks for the help
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using CK editor in iframes 5 26
C# Formatting DateTime String Value 5 50
Coding for the first time 9 62
Visual C# Windows Project - Clone Form 4 17
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question