Hi everyone,

Im recently programming with Visual .net 4.8. I am having trouble with a GridView that has multiple columns. There are 9 columns in total: 4 are always visible, but the others depend on the user's configuration.

I am using the DataBound event to hide these columns. However, when I export the GridView to a TXT file, all columns appear in the output, including the hidden ones. I only want to export the columns that the user has chosen to see.

Should I create a copy of the GridView and delete the unwanted columns before exporting, or is there a better way to handle this?
What do you recommend?

I paste a piece of my code:

HTML Code:
 <asp:GridView ID="gridview_xxx"
     runat="server"
     AutoGenerateColumns="false"
     CssClass="table table-condensed"
     Font-Size="11px"
     Width="100%"
     ToolTip="xxx"
     CellPadding="4"
     GridLines="Both"
     ShowHeaderWhenEmpty="false"
     AllowPaging="false"
     PageSize="25"
     DataKeyNames="id,x1,x2,x3,x4,col1,col2,col3,col4,col5"
     OnRowCommand="xxx_RowCommand"
     OnRowDataBound="xxx_RowDataBound">
Thanks!

Visual Programmer A.A