Is it possible to detect the first and last records while in the itemdatabound event - I need to handle the display for these t rows.
Andy
3 Answers, 1 is accepted
0
Viktor Tachev
Telerik team
answered on 08 Dec 2015, 09:21 AM
Hi Andy,
Checking if the current record is the last would require custom implementation that would depend on how you are binding the grid. For example, if you are using a DataTable to pass data to the RadGrid you can check if the index of the current item is equal to the number of items in the DataTable collection.
With that said, if you would like to change the styles for the first and last items in the grid you can use CSS. The following rules set the background color for the first and last items in the grid.
.rgMasterTable>tbody tr:first-child {
background-color: red;
}
.rgMasterTable>tbody tr:last-child {
background-color: red;
}
Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
If e.Item.DataSetIndex = e.Item.OwnerTableView.DataSourceCount - 1 Then
'Do Stuff
End If
Might help others in my position.
Andy
0
Viktor Tachev
Telerik team
answered on 08 Dec 2015, 11:57 AM
Hello Andy,
Thank you for sharing your solution with the community.
Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items