简体   繁体   中英

Adding a control to to the footer of gridview (asp.net) next to the paging stuff

So is that possible? I know you can add a footer template for specific column, but can you add a control int the footer next to the paging ?

Yes, you need to check in the Row_Created event for a row of type Pager , like this:

private void grdClientServiceType_RowCreated(object sender,   System.Web.UI.WebControls.GridViewRowEventArgs e)
{
    if(e.Row.RowType == DataControlRowType.Pager)
    {
       // Create your control here, button is an example create whatever you want
       Button theButton = new Button();
       theButton.Text = "Click Me";

       // Add new control to the row with the pager via a table cell
       e.Row.Cells[0].ColumnSpan -= 1;
       TableCell td = new TableCell();
       td.Controls.Add(theButton);
       e.Row.Cells.Add(td);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM