Textbox in Excel
I have Gridview
like this.
Here is my last column Gridview
code;
<EditItemTemplate>
<asp:TextBox ID="txtTNOT" runat="server" Height="35" TextMode="MultiLine" DataSourceID="SqlDataSource8"></asp:TextBox>
<asp:SqlDataSource ID="SqlDataSource8" runat="server"
ConnectionString="<%$ ConnectionStrings:SqlServerCstr %>"
SelectCommand="SELECT [T_NOT] FROM [TAKIP] WHERE T_HESAP_NO = @T_HESAP_NO ">
<SelectParameters>
<asp:Parameter Name="T_HESAP_NO" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</EditItemTemplate>
My last column has a Textbox.
When i import to excel with this code;
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.开发者_JAVA百科Clear();
Response.AddHeader("content-disposition", "attachment;filename=TahTakip.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
Still i have a Textbox
in my Excel
file.
How can i delete Textbox
[NOT VALUE INSIDE COLUMN] when i exporting to Excel
?
Best Regards,
Soner
Try this approach as shown in this link(http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html). I would suggest to replace textbox with Label controls to avoid this.
精彩评论