Here's my code:
If e.CommandName <> "Preview" Then Exit Sub
grdItem = CType(e.Item, GridDataItem)
strFile = grdItem.OwnerTableView.DataKeyValues(grdItem.ItemIndex)("preview_file").ToString
This handles a hyperlink button in the RadGrid, and it works fine. But if you try to apply a filter to the grid, you get the error:
Unable to cast object of type 'Telerik.Web.UI.GridFilteringItem' to type 'Telerik.Web.UI.GridDataItem'.
How do I get around this?