Dear All,

I want to set Password when i am export data Grid View to Excel.My
code are following.If there is any other mechanism for this task then
please guide me.I'll be waiting for your helpful reply. Thanks in
advance.



-----------------------------------------------------------------------------------------------------------------------
 protected void ExportExcel()
    {
        Response.ClearContent();
        Response.AddHeader("content-disposition",
"attachment;filename=AOPTownLevel.xls");
        Response.ContentType = "application/ms-excel";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        HtmlForm frm = new HtmlForm();
        GridView1.Parent.Controls.Add(frm);
        frm.Attributes["runat"] = "server";
        frm.Controls.Add(GridView1);
        frm.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();
    }

-----------------------------------------------------------------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to