How to change image of imagebutton control inside listview when data item is bound.

crcsupport
crcsupport used Ask the Experts™
on
I'm trying to change image of imagebutton inside Listview depending on data of items. I coded following, but it doesn't change it.

protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
		.............................
            
            if (File.Exists(Server.MapPath(invoiceFile)))
                ibnInvoice.ImageUrl = "~img/PDFInvoice.gif";
            else
                ibnInvoice.ImageUrl = "~img/PDFInvoice_gray.gif";

           
            
        }
    }

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Use slash after the tild char
 
~/img/PDFInvoice.gif

Author

Commented:
WTF

TNX, man.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial