CustomDataGrid (c#)
A DataGrid object with mouseover effects build in.
using System;
///
/// Summary description for CustomDataGrid.
///
public class CustomDataGrid
{
public string ItemStyleMouseOver;
public string AlternatingItemStyleMouseOver;
public CustomDataGrid()
{
}
protected override void OnItemCreated(DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item)
{
e.Item.Attributes.Add(\"onmouseover\", \"this.className='\" + this.ItemStyleMouseOver + \"'\");
e.Item.Attributes.Add(\"onmouseout\", \"this.className='\" + this.ItemStyle.CssClass + \"'\");
}
if (e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Attributes.Add(\"onmouseover\", \"this.className='\" + this.AlternatingItemStyleMouseOver + \"'\");
e.Item.Attributes.Add(\"onmouseout\", \"this.className='\" + this.AlternatingItemStyle.CssClass + \"'\");
}
base.OnItemCreated (e);
}
}
To use the CustomDataGrid in a page, include the following at the top of the page:
and insert this code where you want the control
I am a .NET programmer first and foremost. But in my spare time I like to play around with PHP, Erlang, Haskell, F#,