?
Solved

Repeating the Header of a GridView on a new page

Posted on 2009-04-20
1
Medium Priority
?
889 Views
Last Modified: 2012-05-06
Okay so I have the code below which is putting a page break in on my chosen criteria.
Now where I'm adding the page break I also want to repeat the header.

How can I do this?
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string ViewAll = Request.QueryString["ViewAll"];
 
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (ViewAll == "YES")
            {
                // do nothing
            }
            else
            {
                int count = GridView1.Rows.Count;
                if (count % 50 == 0)
                {
                    e.Row.Style.Add("page-break-before", "always");
                }
            }
 
                if (ViewAll == "YES")
                {
                    string Aisle = e.Row.Cells[0].Text;
                    
                    if (Convert.ToString(Session["Aisle"]) == Aisle)
                    {
                        // do nothing
                    }
                    else
                    {
                        e.Row.Style.Add("page-break-before", "always");
                    }
                    Session["Aisle"] = Aisle;
                }                        
        }
    }

Open in new window

0
Comment
Question by:andrewmilner
1 Comment
 

Accepted Solution

by:
andrewmilner earned 0 total points
ID: 24198709
I've acheived what I was looking for by simply having all the code and output in the codebehind.
From further reading it didn't appear straightforwardly possible.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

850 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