This is a migrated thread and some comments may be shown as answers.

Problems since upgrading to SP2

6 Answers 182 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hilda Kenny
Top achievements
Rank 1
Hilda Kenny asked on 04 Oct 2010, 11:10 AM
hi, below is a list of errors I have since upgrading to SP2.

1)  'Error 4 function 'ProcessTabKey' cannot be declared 'Overrides' because it does not override a function in a base class. '

 

 

Class

 

CustomGridBehavior

 

 

Inherits BaseGridBehavior

 

 

Protected Overloads Overrides Function ProcessTabKey(ByVal keys As System.Windows.Forms.KeyEventArgs) As Boolean

 

 

 

 

 

If Me.CheckIfLast() Then

 

 

 

 

 

Me.GridControl.EndEdit()

 

 

Me.GridControl.Rows.AddNew()

 

 

Me.GridControl.Rows(Me.GridControl.Rows.Count - 1).IsCurrent = True

 

 

 

 

 

Me.GridControl.Columns(1).IsCurrent = True

 

 

 

 

 

Me.GridControl.Focus()

 

 

Me.GridControl.BeginEdit()

 

 

Return True

 

 

 

 

 

Else

 

 

 

 

 

Me.GridControl.Focus()

 

 

Me.GridControl.EndEdit()

 

 

TryCast(GridControl.DataSource, BindingSource).EndEdit()

 

 

Return MyBase.ProcessTabKey(keys)

 

 

End If

 

 

 

 

 

End Function

 

 

 

 

2)  'Error 5 'ProcessTabKey' is not a member of 'Telerik.WinControls.UI.BaseGridBehavior'. '

 

Same code as above

3)  'Error 6 Value of type 'Debitask.CustomRadGridView' cannot be converted to 'Telerik.WinControls.UI.RadGridViewElement'.'

Class

 

CustomRadGridView

 

 

Inherits RadGridView

 

Public Sub New()

 

Dim gridBehavior As New CustomGridBehavior()

 

gridBehavior.Initialize(

Me)  '<-- This line.

 

 

 

Me.GridBehavior = gridBehavior

 

 

 

 

End Sub

 

4) 'Error 33 Property 'Index' is 'ReadOnly'.'

newColumn =

New GridViewCheckBoxColumn

 

 

With newColumn

 .BestFit()

.HeaderText = 

 "Selected"

 

 

 

 .ReadOnly = False

 

 

 

.Index = 0

 

 

End With

 

 

 

5) Error 38 'CellElement' is not a member of 'Telerik.WinControls.UI.GridViewCellInfo'.

rowCurrent.Cells(

"image").CellElement.Image = Debitask.My.Resources.delete16

 

 

6) Error 117 Event 'GroupSumaryEvaluate' cannot be found'
private  Sub grdAccessGroups_GroupSumaryEvaluate(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GroupSummaryEvaluationEventArgs) Handles grdAccessGroups.GroupSumaryEvaluate

 

 

 

 


6 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 04 Oct 2010, 12:06 PM
Hi Hilda, 

It's a bit tricky to read your code. It's easier if you can use the format code section to render code. But.. 

ProcessTabKey I think is now
Protected Overrides Function ProcessKeyEventArgs(ByRef m As System.Windows.Forms.Message) As Boolean
    Return MyBase.ProcessKeyEventArgs(m)
End Function


The CellElement cannot be navigated to now via RowInfo as the Grid now re-uses cells to support the new Fast Scrolling. In order to get to the CellElement you need to handle the CellFormatting event of the grid. 

The GroupSummaryEvaluate is declared as below
Private Sub grdAccessGroups_GroupSumaryEvaluate(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GroupSummaryEvaluationEventArgs) Handles grdAccessGroups.GroupSummaryEvaluate
 
End Sub

hope that helps
Richard
0
Hilda Kenny
Top achievements
Rank 1
answered on 04 Oct 2010, 12:48 PM
Hi Richard,
Thanks for your help. I am still having some issues:

(1)
I still get 'Error 1 function 'ProcessKeyEventArgs' cannot be declared 'Overrides' because it does not override a function in a base class.'

(2)
Error 3 Value of type 'Debitask.CustomRadGridView' cannot be converted to 'Telerik.WinControls.UI.RadGridViewElement'. C:\projects\Debitask\Debitask\Classes\CustomRadGridView.vb 11 33 Debitask

The code is:
Class CustomRadGridView
    Inherits RadGridView
    Public Sub New()
        Dim gridBehavior As New CustomGridBehavior()
        gridBehavior.Initialize(Me)
        Me.GridBehavior = gridBehavior
    End Sub
  
    Protected Overloads Overrides Sub CreateChildItems(ByVal parent As Telerik.WinControls.RadElement)
        MyBase.CreateChildItems(parent)
    End Sub
  
    Public Overloads Overrides Property ThemeClassName() As String
        Get
            Return GetType(RadGridView).FullName
        End Get
        Set(ByVal value As String)
            MyBase.ThemeClassName = value
        End Set
    End Property
  
End Class


(3)
Error 10 Property 'Index' is 'ReadOnly'.
newColumn = New GridViewCheckBoxColumn
       With newColumn
           .BestFit()
           .HeaderText = "Selected"
           .ReadOnly = False
           .Index = 0
       End With

(4) I have a lot of warnings such as:
GroupByExpressions is now obsolete.  Please use GroupDescriptors instead.  Same with SortExpressions

Private Sub SetGroupExpression()
        Dim expression As GridGroupByExpression
        grdAccessGroups.MasterTemplate.GroupByExpressions.Remove("Access_Group_description GroupBy access_group_description")
        expression = New GridGroupByExpression("Access_Group_description GroupBy access_group_description")
        grdAccessGroups.MasterTemplate.GroupByExpressions.Add(expression)
        grdAccessGroups.MasterTemplate.CollapseAllGroups()
    End Sub

(5)
0
Richard Slade
Top achievements
Rank 2
answered on 04 Oct 2010, 01:11 PM
Hi, 

Your Grid should look like this.. 
Imports Telerik.WinControls.UI
 
Class CustomRadGridView
    Inherits Global.Telerik.WinControls.UI.RadGridView
 
    Public Sub New()
        MyBase.New()
    End Sub
 
    Protected Overloads Overrides Sub CreateChildItems(ByVal parent As Telerik.WinControls.RadElement)
        MyBase.CreateChildItems(parent)
    End Sub
 
    Public Overloads Overrides Property ThemeClassName() As String
        Get
            Return GetType(RadGridView).FullName
        End Get
        Set(ByVal value As String)
            MyBase.ThemeClassName = value
        End Set
    End Property
 
    Protected Overrides Function ProcessKeyEventArgs(ByRef m As System.Windows.Forms.Message) As Boolean
        Return MyBase.ProcessKeyEventArgs(m)
    End Function
 
End Class

You can specify the index of the column when you insert it.. 
Dim newColumn As New GridViewCheckBoxColumn()
With newColumn
    .BestFit()
    .HeaderText = "Selected"
    .ReadOnly = False
End With
Me.CustomRadGridView1.Columns.Insert(0, newColumn)
And your GroupBy should become something like.. 
Private Sub SetGroupExpression()
    Dim expression As GridGroupByExpression
    Me.CustomRadGridView1.MasterTemplate.GroupDescriptors.Clear()
    expression = New GridGroupByExpression("Access_Group_description GroupBy access_group_description")
    Me.CustomRadGridView1.MasterTemplate.GroupDescriptors.Add(expression)
    Me.CustomRadGridView1.MasterTemplate.CollapseAllGroups()
End Sub

Hope that helps
Richard
0
Hilda Kenny
Top achievements
Rank 1
answered on 04 Oct 2010, 03:16 PM
Thanks a lot Richard, I appreciate your time. As regards, the custom grid, I used the code, and thanks for that, but what do I do with the CustomGridBehaviour class?  I have the message:   'Error 2 function 'ProcessKeyEventArgs' cannot be declared 'Overrides' because it does not override a function in a base class.'

Class CustomGridBehavior
    Inherits BaseGridBehavior
    Protected Overloads Overrides Function ProcessKeyEventArgs(ByVal keys As System.Windows.Forms.KeyEventArgs) As Boolean
        If Me.CheckIfLast() Then
            Me.GridControl.EndEdit()
            Me.GridControl.Rows.AddNew()
            Me.GridControl.Rows(Me.GridControl.Rows.Count - 1).IsCurrent = True
            Me.GridControl.Columns(1).IsCurrent = True
            Me.GridControl.Focus()
            Me.GridControl.BeginEdit()
  
            Return True
        Else
            Me.GridControl.Focus()
            Me.GridControl.EndEdit()
            TryCast(GridControl.DataSource, BindingSource).EndEdit()
            Return MyBase.ProcessKeyEventArgs(keys)
        End If
    End Function
.
.
.
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 04 Oct 2010, 03:42 PM
I believe that should be changed to. 
Public Overrides Function ProcessKey(ByVal keys As System.Windows.Forms.KeyEventArgs) As Boolean
    Return MyBase.ProcessKey(keys)
End Function
0
Hilda Kenny
Top achievements
Rank 1
answered on 04 Oct 2010, 04:00 PM
Thanks a lot! I'm just going through warnings now. I appreciate your help.
Tags
GridView
Asked by
Hilda Kenny
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Hilda Kenny
Top achievements
Rank 1
Share this question
or