How to change Row's Background Color in DataList When Hovering?

Jun 25 2008 8:27 AM

Hello all, 

I have a datalist. I want to change the background color of row to some other color upon mouse hover. That i have accomplished in Gridview but somehow I m not getting it in datalist. I have done this till now :

protected void dlprod_ItemCreated(object sender, DataListItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
            e.Item.Attributes.Add("onmouseover", "this.style.background-color='#ccsdcc'");
            e.Item.Attributes.Add("onmouseout", "this.style.background-color='#ffsfff'");
        }
    }

but its not working. pl provide some tweaks ...

Thanks

Prashant V


Answers (3)