How to get image in header of Gridview

G

Guest

I want an image and text in the column header in my GridView. Does anyone
know how to do that? Thanks.
 
V

Vaibhav

I think , I did something like that.
Another way you can do it, from the code behind
System.Web.UI.WebControls.Image imgControl=new
System.Web.UI.WebControls.Image();
imgControl.ImageUrl="images/xyz.gif";
if(e.Item.ItemType==ListItemType.Header)
{
e.Item.Cells[0].Controls.Add(imgControl);
}
 
G

Guest

Thanks. I'll give that a try.

Vaibhav said:
I think , I did something like that.
Another way you can do it, from the code behind
System.Web.UI.WebControls.Image imgControl=new
System.Web.UI.WebControls.Image();
imgControl.ImageUrl="images/xyz.gif";
if(e.Item.ItemType==ListItemType.Header)
{
e.Item.Cells[0].Controls.Add(imgControl);
}

lanem said:
That doesn't work. You can't put HTML code in there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,998
Messages
2,570,242
Members
46,834
Latest member
vina0631

Latest Threads

Top