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

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top