I have a code similar to the one below. My problem is that the event fires up twice. Because of this, the message box is shown two times. Please take a look below and let me know what the problem is. I want the event to be called just once. This is an urgent one. Thank you.
If e.Record IsNot Nothing Then
If e.Action = CurrentRecordAction.EndEditCalled _
Or e.Action = CurrentRecordAction.NavigateCalled Then
Dim rec As Record = gridGroupingControl1.Table.CurrentRecord
Dim colName As String
For i As Integer = 0 To ggc.TableDescriptor.Columns.Count - 1
colName = gridGroupingControl1.TableDescriptor.Columns(i).Name
If rec.GetValue(colName).ToString = "" Then
e.Cancel = True
MessageBox.Show("Please populate all required fields", "Error", _
MessageBoxButtons.OK,MessageBoxIcon.Exclamation)
Exit For
End If
Next
End If
End If
JJ
Jisha Joy
Syncfusion Team
February 20, 2009 05:16 AM UTC
Hi Rentao ,
Thank you for the code snippets.
I have prepared a simple sample to reproduce the issue here. I am afraid that I was not able able to reproduce the issue here. Please refer the sample:
http://websamples.syncfusion.com/samples/Grid.Windows/Forum79656.zipPlease have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the reproducing steps so that we could sort out the cause of the issue
and provide you a solution?
Regards,
Jisha
RB
Reynante Bulayo
February 23, 2009 12:39 PM UTC
Hi Jisha,
I have traced the flow of the code and below is the sequence:
1. I have modified the contents of the record and left some blank, then pressed enter.
1. Grid raises CurrentRecordContextChange event with e.action = EndEditComplete. The messagebox pops out.
2. Grid raises QueryCellStyleInfo event but the first event has only reached up to the code where the messagebox will be displayed.
3. Grid raises CurrentRecordContextChange one more time
Any ideas why I'm hitting this issue? Please help. This is an urgent inquiry. Thank you in advance. :)
RB
Reynante Bulayo
February 24, 2009 02:44 PM UTC
Hi. I just want to follow up my inquiry. Thanks
LS
Lingaraj S
Syncfusion Team
February 24, 2009 05:18 PM UTC
Hi Rentao,
Thank for using a syncfusion product.
The CurrentRecordContextChange event will get fired for twice,this behaviour is because it has to handle both begin edit of the current cell and end edit on the other cell.
So it differs using a property called Action from the event args,you can handle by giving a condtion that depends on the Action property.
Let me know if you have any queries.
Regards,
Lingaraj S
RB
Reynante Bulayo
February 27, 2009 03:28 AM UTC
Actually, the event is raised 2 times with the same action, EndEditCalled, for some reason. I still can't figure out why this is happening. From my understanding, after it enters the event with the said action, the next action should be EndEditComplete. However, this is not the case. Any ideas?
JJ
Jisha Joy
Syncfusion Team
February 27, 2009 08:42 AM UTC
Hi Rentao,
Thank you for your update.
It is difficult to identify the problem without seeing it in a live application. Could you please reproduce the issue in the following sample or provide us a simple sample having the issue, so that we could sort out the cause of the issue and provide you a solution soon?
Regards,
Jisha
RB
Reynante Bulayo
February 27, 2009 11:55 AM UTC
Hi Jisha,
Thanks for the reply. I'll try to recreate the issue and send you the code.
JJ
Jisha Joy
Syncfusion Team
February 28, 2009 04:52 AM UTC
Hi Renteao,
Thank you for your update.
Regards,
Jisha