export to excel without pagination links

Hi experts,

how can i export to xls without pagination links

this is my code

private void ExportGridView()
    {
        string attachment = "attachment; filename=FileName.xls";
        Response.ClearContent();
        Response.AddHeader("content-disposition", attachment);
        Response.ContentType = "application/ms-excel";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);

        // Create a form to contain the grid
        HtmlForm frm = new HtmlForm();
        gvBMSEmps.Parent.Controls.Add(frm);
        frm.Attributes["runat"] = "server";
        frm.Controls.Add(gvBMSEmps);
        frm.RenderControl(htw);

        Response.Write(sw.ToString());
        Response.End();
    }


    public override void VerifyRenderingInServerForm(Control control)
    {

    }


    private void PrepareGridViewForExport(Control gv)
    {
      //  LinkButton lb = new LinkButton();
        Literal l = new Literal();
        string name = String.Empty;
        for (int i = 0; i < gv.Controls.Count; i++)
        {

            if (gv.Controls[i].GetType() == typeof(LinkButton))
            {
                l.Text = (gv.Controls[i] as LinkButton).Text;

                gv.Controls.Remove(gv.Controls[i]);

                gv.Controls.AddAt(i, l);

            }
               PrepareGridViewForExport(gv.Controls[i]);
                   
        }
    }
}

thanks
SirReadAlotAsked:
Who is Participating?
 
SirReadAlotConnect With a Mentor Author Commented:
in datagrid its


dgDeleted.PagerStyle.Visible=false;


can find visib/e of enabled in gridview
0
 
SirReadAlotAuthor Commented:
can't find visible or enabled in

 gridview
0
All Courses

From novice to tech pro — start learning today.