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

[Solved] Grid deletecommand, rows number

1 Answer 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jean-Marc Windholz
Top achievements
Rank 1
Jean-Marc Windholz asked on 30 Oct 2009, 02:39 PM
Hi, my grid has a CommandName="DeleteSelected".
On RadGrid1_ItemCommand event
    If (e.CommandName = "DeleteSelected") Then   
                If Not (RadGrid1.SelectedIndexes.Count = 0) Then 
 
                    Dim myItem As GridDataItem 
 
                    For Each myItem In RadGrid1.SelectedItems                     
                        e.Item.OwnerTableView.PerformDelete(myItem, True) 
                    Next 
 
                    e.Item.OwnerTableView.Rebind() 
 
                End If 
 
            End If

it works fine, delete the selected rows.
Now my goal is to hide/show things depending on how may row the grid has (if 0.. else...)
I use ths: RadGrid1.MasterTableView.Items.Count
but that one returns the number of rows before the delete task.
I tried to put it on RadGrid1_ItemDeleted event but still not getting the new number of rows.

What event? What way?

Thanks



1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Nov 2009, 09:27 AM
Hi Jean,

 You can access the RadGrid item count in the PreRender event which will fire after performing delete operations on all the selected rows.

VB
 Protected Sub RadGrid1_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles RadGrid1.PreRender 
        Dim i As Integer 
        i = RadGrid1.MasterTableView.Items.Count 
End Sub 


Thanks,
Shinu
Tags
Grid
Asked by
Jean-Marc Windholz
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or