Wednesday, September 10, 2014

How to read data from RadGrid?

Hello,

While working on RadGrid, I was in need of real data bind to Grid. I was able to access text of GridViewItem using (gridItem("col1").Text) but if text is formatted, then only you can see is the formatted data.

To see the exact data bind to Grid, use the DataItem property as shown below:

Private Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles RadGrid1.ItemDataBound

    Dim gridItem As GridDataItem = CType(e.Item, GridDataItem)
    Dim data as String = DirectCast(gridItem.DataItem, System.Data.DataRowView).Row.ItemArray(0)

End Sub


HTH

No comments: