Completed
Last Updated: 06 Jan 2017 09:18 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 29 Nov 2016 10:56
Category: GridView
Type: Bug Report
0
FIX. RadGridView - cancelling the UserAddingRow event doesn't keep the new row current
To reproduce:

Sub New()
     
    InitializeComponent()

    Dim dt As New DataTable
    dt.Columns.Add("Id", GetType(Integer))
    dt.Columns.Add("Name", GetType(String))
    dt.Columns.Add("Description", GetType(String))

    For index = 1 To 5
        dt.Rows.Add(index, "Item" & index, "Description" & index)
    Next
    Me.RadGridView1.DataSource = dt
    Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill
    
    AddHandler Me.RadGridView1.UserAddingRow, AddressOf UserAddingRow

End Sub

Private Sub UserAddingRow(sender As Object, e As Telerik.WinControls.UI.GridViewRowCancelEventArgs)
    Me.RadGridView1.MasterView.TableAddNewRow.ErrorText = ""
    If String.IsNullOrEmpty(e.Rows(0).Cells(0).Value) Then
        e.Cancel = True
        Me.RadGridView1.MasterView.TableAddNewRow.ErrorText = "Empty value is not allowed!"
    End If
End Sub

1. Click the new row and enter a value in the last cell. 
2. Click outside the new row, e.g. click on a data row. The UserAddingRow event is canceled and the new row remains current. 
3. Click a data row again without any modification on the new row. The new row is not current anymore. 
4. However, you perform step 1and 2 but instead of clicking a data row, the user clicks a header cell, the new row is not current from the first time. It is necessary to forbid the user to exit the new row until the validation passes or the new row is canceled by pressing Enter.

Workaround:  use the CellValidating/RowValidating event for validating.
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments