Custom Paging on GridView using


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
Who is Participating?
Nathan BoveConnect With a Mentor Software EngineerCommented:
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
nandithaaConnect With a Mentor Commented:
U can do like this:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        GridView1.PageIndex = e.NewPageIndex;
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
        GridView1.AllowPaging = CheckBox1.Checked;

Open in new window

kishan66Author Commented:
reason for giving less points  --- Solution is not complete..had to call loadGrid and DataBind too.
thanks for the help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.