user1292656 user1292656 - 1 month ago 9
ASP.NET (C#) Question

Insert custom Button inside Gridview pager

I am trying to insert a control inside Gridview pager. The Control appears successfuly but it assign it under the previous control as you can see in the picture.

enter image description here

I am adding with the following code.

if (e.Row.RowType == DataControlRowType.Pager)
{
e.Row.Cells[0].Controls.Add(ImageButton1);
}


What i want is to assign the Save Answers button next to Previous button and not below. Any help pls ?

Answer
if (e.Row.RowType == DataControlRowType.Pager)
{
    Table pagerTable = (e.Row.Cells[0].Controls[0] as Table);
    TableRow row = new TableRow();
    row = pagerTable.Rows[0];
    TableCell cell1 = new TableCell();
    cell1.Controls.Add(ImageButton1);

    row.Cells.AddAt(1,cell1);
}