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 adding custom controls to grid cells and the grid seems to be eating the events that normally would fire for the control, including the control''s validating event -- this is the event I would prefer to use for validation. Since this was not working I attempted to use the CurrentCelllValidating event, but this does not fire for this cell. How do I validate the grid cell? If possible, I''d prefer to use the control''s validating event.
Here''s what I''m doing:
Dim newCustomControl As New CustomControl
Me.Controls.Add(newCustomControl)
AddHandler newCustomControl.Validating, AddressOf newCustomControl_Validating
With grdOptions.Item(rowIndex, colIndex)
.CellType = "Control"
.Control = newCustomControl
.CellValueType = GetType(String)
End With
Thanks.
ADAdministrator Syncfusion Team May 18, 2006 04:32 AM UTC
Hi Jenny,
Typically this types of error occurs if you are not properly handle CurrentCell.IsModified flag. Without setting the CurrentCell.IsModified = true, your saveCellInfo is not called when you leave the cell the control which means your changes were not being saved in the grid. SaveCellInfo event fires the CurrentCellValidating Event. Please try this code in CurrentcellMoving Event
Private Sub gridControl1_CurrentCellValidating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles gridControl1.CurrentCellValidating
Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell
Dim user As UserControl1 = CType(IIf(TypeOf cc.Renderer.Control Is UserControl1, cc.Renderer.Control, Nothing), UserControl1)
If Not user Is Nothing Then
MessageBox.Show(user.Uservalue,"Selected Language")
End If
End Sub
Private Sub gridControl1_CurrentCellMoving(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCurrentCellMovingEventArgs) Handles gridControl1.CurrentCellMoving
Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell
If cc.MoveFromRowIndex = 1 AndAlso cc.MoveFromColIndex = 1 Then
Dim user As UserControl1 = CType(IIf(TypeOf cc.Renderer.Control Is UserControl1, cc.Renderer.Control, Nothing), UserControl1)
If Not user Is Nothing Then
cc.IsModified = True
End If
End If
End Sub
Here is a sample.
http://www.syncfusion.com/Support/user/uploads/VBControlValidating_49578baf.zip
Let me know if you have any more questions.
Regards,
Haneef
JWJenny WilsonMay 18, 2006 11:04 PM UTC
Setting the IsModified property in CurrentCellMoving was just what I needed.
Thanks!