I have the following code:
I would like to be able to load a picture, based on ther row the user has currently hovered their mouse over in the DataGrid. When I tried debugging it, the:
LoadStaffImage( e.Item.Cells[6].Text);
line seems to load repeatedly for each row in the grid but it is not called again when the user hovers over the row. Why does this happen and can you point me in the right direction of what event I should use to do this task if the _ItemDataBound event is not the correct one?
I've also tried impleenting this in the SelectIndexChan ged and EditCommand events. The ItemDataBound event appears to be the only one which has DataGridItemEve ntArgs as its event argument.
Many thanks
Matt
Code:
protected void contactsGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.SelectedItem)
{
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='LightBlue'");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#EFF3FB'");
LoadStaffImage(e.Item.Cells[6].Text);
}
}
LoadStaffImage( e.Item.Cells[6].Text);
line seems to load repeatedly for each row in the grid but it is not called again when the user hovers over the row. Why does this happen and can you point me in the right direction of what event I should use to do this task if the _ItemDataBound event is not the correct one?
I've also tried impleenting this in the SelectIndexChan ged and EditCommand events. The ItemDataBound event appears to be the only one which has DataGridItemEve ntArgs as its event argument.
Many thanks
Matt
Comment