Solved

Custom Paging on GridView using C#.net

Posted on 2011-03-17
4
549 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Using Simpleject with Class Library 11 25
DLL in ASP.NET 20 45
C# Reverse int in fast ways 6 28
Hidden Field Value 10 34
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now