?
Solved

Custom Paging on GridView using C#.net

Posted on 2011-03-17
4
Medium Priority
?
600 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 7

Accepted Solution

by:
nbove 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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