This didn't work for me, nothing appears in the HTML. I also tried:
protected void VanListGridView_PreRender( object sender, EventArgs e ) {
GridView grid = ( sender as GridView );
if ( grid != null ) {
GridViewRow pagerRow = grid.BottomPagerRow;
if ( pagerRow != null && pagerRow.Visible ) {
Table pagerTable = ( pagerRow.Cells[0].Controls[0] as Table );
HyperLink hlink = new HyperLink();
hlink.NavigateUrl = "VanListDetail.aspx";
hlink.Text = "New...";
hlink.CssClass = "waLink";
//pagerRow.Cells[0].Controls.AddAt( 0, hlink );
pagerRow.Cells[0].Controls.Add( hlink );
}
}
}
which also did nothing. I would be willing to use a PagerTemplate but would
like to keep the automagic page numbers links that are generated by the
GridView.
Any suggestions?
"Phillip Williams" wrote:
If you are looking to add a static control (that does not need to raise a
server-side event) then consume the RowCreated event instead of overwritting
the PagerTemplate, e.g.
void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType==DataControlRowType.Pager)
{
HyperLink hlink= new HyperLink();
hlink.NavigateUrl="AnotherPage.aspx";
hlink.Text="PageTitle";
//notice that the pager template renders one cell in which
//there is an HTMLTable
e.Row.Cells[0].Controls.Add(hlink);
}
}
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
When I try and edit the PagerTemplate it erases the default paging controls.
Is there a way to add a link control to this region while still keeping the
default paging controls?
Thanks.