We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Query on gridGroupingControl1.Validate() and gridGroupingControl1.Table.CurrentRecord.EndEdit()

Hi, I am doing update to the database on click of the button and also when the user moves from one row to the other. The user can choose they want row by row update or batch update. To do row update I am doing on this.gridGroupingControl1.SourceListListChanged event. I have written a common function to call in both scenarios. To get the current slected column value I am using following three lines. this.gridGroupingControl1.Validate(); if (this.groupingGrid.SyncfusionGridControl.Table.CurrentRecord != null) this.groupingGrid.SyncfusionGridControl.Table.CurrentRecord.EndEdit(); vaildate() and EndEdit() fires, this.gridGroupingControl1.SourceListListChanged event. So when I do Update on click of a button, this in turn fires this.gridGroupingControl1.SourceListListChanged event. My common function is executing 3 times...How can I handle this..? Thanks, Prathima

9 Replies

AD Administrator Syncfusion Team June 27, 2005 03:33 AM

>>when I do Update on click of a button First thing to check is whether this button has its CausesValidation property set to true. If so, then the act of clicking the button will trigger a call to grid.Validate. Try setting button.CausesValdiation = false to see if that removes any of the calls to your saving code.


PV Prathima Venkobachar June 27, 2005 06:37 AM

Even if I do CauseValidation false, its not affecting. I feel problem is in these lines. this.gridGroupingControl1.Validate(); if (this.groupingGrid.SyncfusionGridControl.Table.CurrentRecord != null) this.groupingGrid.SyncfusionGridControl.Table.CurrentRecord.EndEdit(); I have written these lines in my common function. when I call this line this.gridGroupingControl1.Validate();, this in turn fires SourceListChanged event on my button click. Sourcelist changed event should be fired when I move from one row to other. But it is called when I am in the same row and try to update by clicking on the button. Can you suggest me, any other event where I can do the update when the user moves from one row to other..? Thanks, Prathima


AD Administrator Syncfusion Team June 27, 2005 07:14 AM

In a button click, you normally do not have to call Validate as it is called for you. Here is a little sample that saves the changes, as you move from row to row, or when you click a button, using a common save method. In this sample using 3.2.1.0, it only has to handle SourceListChanged to handle both cases. What are you doing differently? http://www.syncfusion.com/Support/user/uploads/GGC_HeaderText_d1f3057c.zip


PV Prathima Venkobachar June 28, 2005 03:54 AM

Hi, There is a slight difference in the way I am doing. I have made the grid as a user control, and placed the usercontrol in the form. I need a suggestion. where should I place these two lines. ((System.ComponentModel.ISupportInitialize)(this.gridGroupingControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridGroupingControl1)).EndInit(); I have placed in the form, this is not getting me the current cell changes. Thanks, prathima


AD Administrator Syncfusion Team June 28, 2005 04:09 AM

I am not sure I understand your question. Normally, System.ComponentModel.ISupportInitialize.BeginInit/EndInit is part of the designer generated code. You do not have to call it at all. In your case, since the GridGroupingControl is on a UserControl, then this code would be found in the designer generated code in the user control class. And, unless you explicitly exposed the grid to the form, then you would not access the grid at all from within the form''s code. You would only interact with it in the UserControl class.


PV Prathima Venkobachar June 28, 2005 04:18 AM

Hi, Thnaks for the reply.You are right,It is there in my user control. On click of the button I am not getting the current cell changes. Thanks, Prathima


PV Prathima Venkobachar June 28, 2005 04:21 AM

>Hi, > >Thnaks for the reply.You are right,It is there in my user control. >On click of the button I am not getting the current row/cell changes. > >Thanks, >Prathima


AD Administrator Syncfusion Team June 28, 2005 05:17 AM

Here is that sample modified to use a usercontrol holding the grid. Clickong a button on the form causing the saing code to be hit once without doing anything special. Now, is your usercontrol directly on the form, or is it in a toolbar or some other container that might be affecting whether the usercontrol causes validation when you leave it? UC_GGC_4410.zip


PV Prathima Venkobachar June 29, 2005 06:18 AM

Hi, Thanks for the analysis. I am using my grid control in the form and opening the form from the menu. Control ,form and menu form are all in the different projects. I tried to solve tis problem by keping a flag check. I am able to update row by row and also on button click. Your suggestion help a lot !!. Thanks, Prathima

Loader.
Live Chat Icon For mobile
Up arrow icon