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

Posted on 2006-05-30
Last Modified: 2010-07-27
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.
Question by:vort3xxx
    1 Comment
    LVL 22

    Accepted Solution

    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

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now