Remove Gridview Column for printer output via css print media cssclass declaration

I want to have a seamless printing process on my page where I use css to remove elements via the display:none; property.  I'm fine with doing that on menus and navigational / block level elements, but I'm not sure how to attach that print style to a column in a gridview.   For instance, I have a gridview with these columns.

Visit Time - Patient Name - Room # - DoctorName - ModifyAppointment

I want to remove the ModifyAppointment Column via a class or css so that I don't have to make a print version to remove it from printer output.  

I'm assinging middle point value to the question since it seems to be just a question of where to attach the cssclass property & looks relatively simple.
vort3xxxAsked:
Who is Participating?
 
Jason ScolaroCommented:
Yeah, should be pretty simple, you'll just need to attach your style, let's call it "noPrint", in the HeaderStyle and ItemStyle CssClass property for the specific columns you want hidden.  It should look something like:

<asp:BoundField HeaderText="ModifyAppointment" DataField="ModifyAppointment" ItemStyle-CssClass="noPrint" HeaderStyle-CssClass="noPrint" />

Good luck!
-- Jason
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.