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

  • Home
  • SEARCH
  • 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 3392410
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:55:02+00:00 2026-05-18T03:55:02+00:00

Hey, I am trying to make my datagrid printable. To do this, I am

  • 0

Hey, I am trying to make my datagrid printable. To do this, I am trying to hide the final 4 columns. I have a printable button that I would like to when clicked, make those last 4 columns disappear. I have so far failed to make this work.

I have tried:

 ProductsGrid.Columns[6].ControlStyle.Width = -1;

and

 ProductsGrid.Columns[6].Visible = false;

Note: these columns do have data in them. Perhaps that is part of my issue. Also, I need the headers of the columns to disappear.

Thanks for any tips.

EDIT: I am making them invisible in my button click command. I am not using generated columns, so I think that is set to false. I got a bit fed up with this issue and left work, and won’t be back till mid next week, so I might have to hold off finding the solution till then. Thanks for the comments everyone, I will look it over soon. Sorry, I can’t give more feedback in a timely fashion.

Edit x2: Do have I have to handle it in some sort of postback or something?

  • 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-18T03:55:03+00:00Added an answer on May 18, 2026 at 3:55 am

    If you have AutoGenerateColumns=”True”, then it does not work to make them invisible by simply set visible=False, because automatically generated bound column fields are not added to the Columns collection.

    VB.Net, but i think you get the idea:

    Private Sub setPrinterView()
      For Each tr As TableRow In DirectCast(Me.GridView1.Controls(0), Table).Rows
          For i As Int32 = 1 To 4
              If tr.Cells.Count - i < 0 Then Exit For
              tr.Cells(tr.Cells.Count - i).Visible = False
          Next
       Next
    End Sub
    

    If AutogenerateColumns is set to False you only need to make the Columns invisible without rebinding the Grid.

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

Sidebar

Related Questions

Hey everyone. I'm trying to make a swing GUI with a button and a
Hey I am trying to make a page that inserts some strings into a
Hey, I am trying to make an if statement that redirects them to a
Hey, I am trying to make a program that minimises any program to the
hey guys, im trying to make a volunteer form, that takes info such as
Hey there, I'm trying to make a site which have following: News, Products, About
Hey, I'm Trying to make a programa in C++ that generate triangle, square and
hey all, i been trying to make a class that uses a dictionary to
Hey, I'm trying to make a basic hockey style game. I have the basic
Hey guys, I'm using smarty and php I am trying to make this function

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.