[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

DataGrid Column Header Image

Posted on 2004-12-01
4
Medium Priority
?
334 Views
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.
0
Comment
Question by:lyptus
  • 3
4 Comments
 
LVL 11

Expert Comment

by:sachiek
ID: 12722478
One question..

Are you trying this for windows Forms or Web application?

Sachi
0
 
LVL 11

Expert Comment

by:sachiek
ID: 12722561
Well, it is quiet a trick.

It should be like this.

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


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.

Sachi
0
 

Author Comment

by:lyptus
ID: 12726486
Sorry, I should have clarified. I'm trying to do this on a windows form.
0
 
LVL 11

Accepted Solution

by:
sachiek earned 2000 total points
ID: 12732156
Ok...Here you go.
Already this had been done and been published in this below website.

http://www.codeproject.com/cs/miscctrl/customheader.asp

Hope you got it right.


Sachi
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month18 days, 12 hours left to enroll

834 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