The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I''m using a custom control, and if my validation fails, I want to restore the original value, but am having no luck. I think the problem is that the control text never gets into the grid. I''ve attempted to set it, but it doesn''t "stick" _ I''m thinking I should be doing this elsewhere..but where? I tried SaveCellInfo - didn''t work for me. Here''s what I''ve got in CurrentCellValidating:
With grdInsertDataOptions
colIndex = .CurrentCell.ColIndex
rowIndex = .CurrentCell.RowIndex
If String.Compare(.Item(rowIndex, colIndex).CellType, "Control", True) = 0 Then
newValue = .CurrentCell.Renderer.Control.Text
oldValue = .Item(rowIndex, colIndex).Text
If newValue = "blah" Then
.CurrentCell.Renderer.Control.Text = oldValue
e.Cancel = True
MessageBox.Show("Invalid Entry")
Else
.Item(rowIndex, colIndex).Text = newValue
e.Cancel = False
End If
End If
End With
ADAdministrator Syncfusion Team May 22, 2006 05:56 AM UTC
Hi Jenny,
You can use this code to get the oldvalue of the control cell in a grid using CurrentCellStartEditing event. Here is a code snippet.
Private oldvalue As String = String.Empty
Private Sub gridDataBoundGrid1_CurrentCellStartEditing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles gridDataBoundGrid1.CurrentCellStartEditing
Dim cc As GridCurrentCell =Me.gridDataBoundGrid1.CurrentCell
If cc.RowIndex = 1 AndAlso cc.ColIndex = 1 Then
oldvalue = cc.Renderer.Control.Text
End If
End Sub
Please let me know if this helps.
Best Regards,
Haneef
ADAdministrator Syncfusion Team May 23, 2006 07:16 PM UTC
Hi,
That did the trick. Thanks for helping with my synconfusion... Would be nice if there was some sort of document describing when and the order of the grid events firing.
Thanks,
Jenny
>Hi Jenny,
>
>You can use this code to get the oldvalue of the control cell in a grid using CurrentCellStartEditing event. Here is a code snippet.
>
>Private oldvalue As String = String.Empty
>
>Private Sub gridDataBoundGrid1_CurrentCellStartEditing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles gridDataBoundGrid1.CurrentCellStartEditing
> Dim cc As GridCurrentCell =Me.gridDataBoundGrid1.CurrentCell
> If cc.RowIndex = 1 AndAlso cc.ColIndex = 1 Then
> oldvalue = cc.Renderer.Control.Text
> End If
>End Sub
>
>Please let me know if this helps.
>Best Regards,
>Haneef