Imports Telerik.Web.UI

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        Dim xmlstring As String = "<Items><Item ID=""1"" money=""35.00"" /><Item ID=""2"" money=""15.00"" /><Item ID=""3"" money="""" /><Item ID=""4"" money="""" /></Items>"
        Dim streamreader As New System.IO.StringReader(xmlstring)
        Dim xmlreader As New System.Xml.XmlTextReader(streamreader)
        Dim dataset As New System.Data.DataSet()
        dataset.ReadXml(xmlreader)
        RadGrid1.DataSource = dataset
    End Sub

    Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
        If TypeOf e.Item Is GridDataItem Then
            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
            Dim value As Double
            If [Double].TryParse(item("money").Text, value) Then
                item("money").Text = value.ToString("C")
            End If
        End If
    End Sub
End Class
