?
Solved

Custom Paging on GridView using C#.net

Posted on 2011-03-17
4
Medium Priority
?
615 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:
Nathan Bove earned 1600 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 6

Assisted Solution

by:nandithaa
nandithaa earned 400 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

864 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