Intellisense has stopped working

A great post on stackoverflow.com resolves the issue. Thanks Gordon Bell

http://stackoverflow.com/questions/178846/visual-studio-intellisense-stopped-working

This has resolved issues in the past with Telerik.Web.UI not working or using an older version even after upgrading Telerik using the windows installer.

Advertisements

Telerik Grid – Event Handlers

I am writting this article because its very common to use event handlers on grids and I find that im always forgetting how to access columns, rows data, datakeynames etc. So i have put together a list below of methods i commonly use.

 

OnNeedsDataSource

Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource

	RadGrid1.DataSource = New CommsBLL().GetInbox(HttpContext.Current.User.Identity.Name)

End Sub

 

ItemDataBound

This event is called after the row has been added to the grid allow you to access any controls/data that has been bound.

Access a column contents

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        'get grid row
        If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then
            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

            item("columnName").Text = "new value"
        End If
End Sub

Access DataKeyName and add new controls to column

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then

            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
            Dim status As String = item.GetDataKeyValue("status")
            Dim cell As TableCell = item("status")

            cell.Controls.Clear()
            Dim image As New Image
            If status = "Unread" Then
                image.ImageUrl = "/clips/icons/newmessage.gif"
            ElseIf status = "Replied" Then
                image.ImageUrl = "/clips/icons/replied.png"
            Else
                image.ImageUrl = "/clips/icons/readmessage.gif"
            End If
            cell.Controls.Add(image)

        End If

    End Sub

ItemCommand

Protected Sub FinancialsGrid_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles FinancialsGrid.ItemCommand

        If e.CommandName = "Delete" Then

            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

            Dim transactionID As Integer = item.GetDataKeyValue("TransactionID")

            'etc

        End If

    End Sub