3
Answers

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

Ask a question

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)