J
J'son
Guys,
I have created a custom class that derives from DataList so that I can
add some custom client side functionality into each new item row
(<td>). Heres the class in its simplest form:
public class MyDataList : DataList
{
public string MyValue1 = "alert('Hey there!');";
public string MyValue2 = "alert('Hey there yourself!');";
protected override DataListItem CreateItem(int itemIndex,
ListItemType itemType)
{
DataListItem item = base.CreateItem(itemIndex, itemType);
if (itemType == ListItemType.Item || itemType ==
ListItemType.AlternatingItem)
{
item.Attributes.Add("onmouseover", MyValue1);
item.Attributes.Add("onmouseout", MyValue2);
}
return item;
}
}
Pretty simple right? Well, when I put MyDataList on the page and
DataBind() my items to it, the attributes are NOWHERE to be seen. The
items and their values show up great, just not my attributes.
Anyone have any thoughts?
Thanx!
J'son
I have created a custom class that derives from DataList so that I can
add some custom client side functionality into each new item row
(<td>). Heres the class in its simplest form:
public class MyDataList : DataList
{
public string MyValue1 = "alert('Hey there!');";
public string MyValue2 = "alert('Hey there yourself!');";
protected override DataListItem CreateItem(int itemIndex,
ListItemType itemType)
{
DataListItem item = base.CreateItem(itemIndex, itemType);
if (itemType == ListItemType.Item || itemType ==
ListItemType.AlternatingItem)
{
item.Attributes.Add("onmouseover", MyValue1);
item.Attributes.Add("onmouseout", MyValue2);
}
return item;
}
}
Pretty simple right? Well, when I put MyDataList on the page and
DataBind() my items to it, the attributes are NOWHERE to be seen. The
items and their values show up great, just not my attributes.
Anyone have any thoughts?
Thanx!
J'son