DataGrid Column Header Image

Posted on 2004-12-01
Last Modified: 2010-04-15
Does anyone know how to put an image in a datagrid's column header using C#? I've searched the Web high and low. I've found lots of articles talking about putting images in the datacells of a column but nothing on putting an image in a column's header.
Question by:lyptus
    LVL 11

    Expert Comment

    One question..

    Are you trying this for windows Forms or Web application?

    LVL 11

    Expert Comment

    Well, it is quiet a trick.

    It should be like this.

    <asp:TemplateColumn HeaderText="Employee ID">
                                              <asp:Label id="Label4" runat="server">Employee ID</asp:Label>
                                              <asp:Image id="Image1" runat="server" ImageUrl="admin.ico"></asp:Image>
                                              <asp:Label id=Label3 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.employeeid") %>'>

    It is just above Itemtemplate , add there is template called HEADERTEMPLATE. You can use it to display image in header.

    Hope you got it right.


    Author Comment

    Sorry, I should have clarified. I'm trying to do this on a windows form.
    LVL 11

    Accepted Solution

    Ok...Here you go.
    Already this had been done and been published in this below website.

    Hope you got it right.


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    729 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