Click here to Skip to main content
15,914,500 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
Hi all, i'm new at web development and have a problem. I have gridview with
pager Next/Previous buttons and they are at the bottom right of the grid(PagerStyle HorizontalAlign="Right"). How do i add a label to the bottom left of the grid but in the same row as the pager?...I have tried this but it adds the label to right of the pager buttons and the label doesnt look like its inside the grid.

C#
protected void DistributionGrid_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Pager)
        { Label label = new Label();
                label.ID = "lbResult";
                label.Text = "Showing results";
                label.CssClass = "results";

                TableCell td = new TableCell();
                td.Controls.Add(label);              
                e.Row.Cells.Add(td);             
        }
    }
Posted
Updated 2-Aug-12 1:26am
v2

1 solution

Nice Question (Rated 5 stars)...

I have learnt a lot while working this out...

For this you can use the GridView's PagerTemplate[^] property. (The link here has an example that does close to what you want...).
You just have to write the controls you need inside PagerTemplate tags.

Do also check another example at PagerTemplate not showing in GridView [^].
Thanks...
 
Share this answer
 
Comments
Ruwaldo 3-Aug-12 8:20am    
Thanks for the answer, the first link is what i needed to see.
Great... So you did what you needed. It was a nice question indeed...
Thanks... Happy Coding...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900