Hello to all.
Please let me know how to define grid view.
When I put following code in to the application file the error ?Type 'GridView' is not defined? persists all the time. Please help me
'Deletes selected data and group rows
Public Sub DeleteSelectedR ows(ByVal view As GridView)
'Create a list containing selected row handles
Dim selRowsCount As Integer = view.SelectedRo wsCount
If selRowsCount = 0 Then Return
Dim selRows As ArrayList = New ArrayList(view. GetSelectedRows ())
'Process selected group rows and add their child data rows to the list
Dim i As Integer
For i = 0 To selRowsCount - 1
getChildRowHand les(view, CType(selRows(i ), Integer), selRows)
Next
'Copy list elements to an array
Dim selRowsArray(se lRows.Count - 1) As Integer
For i = 0 To selRowsArray.Le ngth - 1
selRowsArray(i) = CType(selRows(i ), Integer)
Next
'Sort the array
Array.Sort(selR owsArray)
'Prevent excessive visual updates while deleting
view.BeginUpdat e()
Try
'Delete rows starting from the last element
For i = selRowsArray.Le ngth - 1 To 0 Step -1
view.DeleteRow( selRowsArray(i) )
Next
view.ClearSelec tion()
Finally
view.EndUpdate( )
End Try
End Sub
'Returns handles of child data rows for the given group row
Public Sub getChildRowHand les(ByVal view As GridView, ByVal groupRowHandle As Integer, ByVal childRowHandles As ArrayList)
If Not view.IsGroupRow (groupRowHandle ) Then Return
'Get the number of immediate children
Dim childCount As Integer = view.GetChildRo wCount(groupRow Handle)
Dim i As Integer
For i = 0 To childCount - 1
'Get the handle of a child row with the required index
Dim childHandle As Integer = view.GetChildRo wHandle(groupRo wHandle, i)
'If the child is a group row, then add its children to the list
If view.IsGroupRow (childHandle) Then
getChildRowHand les(view, childHandle, childRowHandles )
Else
'The child is a data row. Add it's handle to childRowHandles providing that the handle was not added before
If Not childRowHandles .Contains(child Handle) Then childRowHandles .Add(childHandl e)
End If
Next
End Sub
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>LQeKh2cnvUe OU+4hSoR+CA==</Id>