Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4044514
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:15:55+00:00 2026-05-20T13:15:55+00:00

I have a Gridview like this picture. Easyly in my last column, i keep

  • 0

I have a Gridview like this picture. Easyly in my last column, i keep a note for that row. (Simply, i made it edit, select, update that gridview classic properties.)

enter image description here

As you can see, my last column has a Textbox (Multiline)

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>

And then i export this Gridview to excel with this code;

protected void LinkButton1_Click(object sender, EventArgs e)
  {
    Response.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();
  }

There is no problem since this step. The problem is when i open this excel file, NOT column is different the other columns. It has a Textbox like this picture;

enter image description here

I don’t want to be a Textbox in my Excel file. Just want a normal cell with a NOT value like left column.

How can i do that?

Best Regars,

Soner

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:15:56+00:00Added an answer on May 20, 2026 at 1:15 pm

    you need to export datatable instead your GridView as you have controls in gridview that can’t be export to excel

    Edit: you can do like..

    protected void btnExportExl_Click(object sender, EventArgs e)
    {
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        string attachment = "attachment; filename=BusinessUnit.xls";
        Response.ClearContent();
        Response.AddHeader("content-disposition", attachment);
    
        GridView grd = new GridView();
        grd.DataSource = datatable.DefaultView; // you get the datatable from DB that will not have controls!!!
        grd.DataBind();
    
        grd.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.Flush();
        Response.End();
    }
    

    please note, in the actual grid I have some image button and when I am exporting then I get the datatable again from DB

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Gridview like this. Here is my last column Gridview code; <EditItemTemplate> <asp:TextBox
We have a GridView that bind to some data and it look like this:
i have an gridview that retrieves the data via a datatable like this: protected
I have a GridView with one ButtonField column like this: I have already Created
I have a gridview that looks something like this: <TemplateColumn> <ItemTemplate> <a href='<%#Eval(FilePathUrl)%>'>FileName</a> </ItemTemplate>
hi I have this gridview like this. <asp:DropDownList ID=triggerDropDown runat=server AutoPostBack=true onselectedindexchanged=triggerDropDown_SelectedIndexChanged> <asp:GridView ID=myGridView
I have a GridView what I fill through a LINQ expression. Something like this:
i have searched Xcode controls but doesn't found anything that makes a GridView like
I have gridview in my asp.net 3.5 application [C#]. Which looks like this: <asp:GridView
I have a gridview were I define some columns, like this... <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.