Hello Christian,
You can access a control in the item and change its class based on the item index. Here's a basic example I made for you:
protected
void
rlv1_ItemDataBound(
object
sender, RadListViewItemEventArgs e)
{
if
(e.Item.ItemType == RadListViewItemType.DataItem)
{
RadListViewDataItem itm = e.Item
as
RadListViewDataItem;
if
(itm.DataItemIndex % 10 == 0)
{
(itm.FindControl(
"Label1"
)
as
Label).CssClass +=
" specialItem"
;
}
}
}
protected
void
rlv1_NeedDataSource(
object
sender, RadListViewNeedDataSourceEventArgs e)
{
(sender
as
RadListView).DataSource = GetSomeData();
}
private
DataTable GetSomeData()
{
DataTable tbl =
new
DataTable();
tbl.Columns.Add(
new
DataColumn(
"ID"
,
typeof
(
decimal
)));
tbl.Columns.Add(
new
DataColumn(
"textField"
,
typeof
(
string
)));
tbl.Columns.Add(
new
DataColumn(
"valueField"
,
typeof
(
int
)));
tbl.Columns.Add(
new
DataColumn(
"fourthField"
,
typeof
(
string
)));
for
(
int
i = 0; i < 50; i++)
{
tbl.Rows.Add(
new
object
[] {i,
"text "
+ i, i*i,
"data "
+ i });
}
return
tbl;
}
Regards,
Marin Bratanov
Progress Telerik
Get
quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.
Learn More.