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

RowLeave and RowEnter events.

I''m using the GridDataBoundGrid and I am subscribing to the RowLeave and RowEnter events to do some data manipulation. I noticed that when I move from or to "read only" cell these events aren''t triggered. Why??? How can I detect the row selection change without these eevnts??

7 Replies

AD Administrator Syncfusion Team June 23, 2004 08:36 PM UTC

I tried to see this problem in this sample. The blue column is readonly, and the RowEnter and RowLeave events fire as you move form one row to another in that column. What are you doing differently? ColNameSample_5868.zip


KS kstoj June 24, 2004 02:58 PM UTC

Hi! Thanks for the replay. Well in our grid we are doing many involved things. GridBoundColumns are created and then added as a range to the Grid. The data for the columns comes from different places, the columns have styles applied to them so some of them are drop down lists. Some columns have a ReadOnly property set to true, some represent the data Properties with the "getter" only. Any way when you example works find, I can''t make the RowLeave and RowEnter events to triggere reliably in our grid. The events don''t occure when moving to or from the "read only" columns ( as stated before ).


AD Administrator Syncfusion Team June 24, 2004 03:42 PM UTC

Can you post a sample showing things not working? Are you setting e.Cancel = ture in any event that may cancel the moving of a cell, like CurrentCellMoving, CurrentCellDeactivating, CurrentCellActivaating, CurrentCellvalidating, etc? Do you have our source code? If so, you can use the Assembly Manager to build a debug version of our libraries, and try to debug into our code to spot what the event is not firing in your application.


KS kstoj June 29, 2004 04:40 PM UTC

I can''t post the code sample. But I have more informations about this problem. I run a simple test and I have noticed that when I apply custom defined style to the columns I have described problem without the styles defined all mentioned events trigger properly. Unfortunate thing is that we need to have specific custom styles applied to columns. Any ideas??


KS kstoj June 29, 2004 04:48 PM UTC

Here is the code in which we set the column styles: for( int i = 0; i < this.gridColumns.Length; i++ ) { string map; map = gridColumns[i].MappingName; switch( map ) { case "FieldWorkerID": CollectorUserDataCollection userData = new CollectorUserDataCollection(false); ArrayList dataSource = userData.SetupCollectorList(); gridColumns[i].StyleInfo.CellType = "ComboBox"; gridColumns[i].StyleInfo.CellValueType = typeof(string); gridColumns[i].StyleInfo.DisplayMember = "UserName"; gridColumns[i].StyleInfo.ValueMember = "UserID"; gridColumns[i].StyleInfo.DataSource = dataSource; gridColumns[i].StyleInfo.DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Editable; gridColumns[i].StyleInfo.ShowButtons = Syncfusion.Windows.Forms.Grid.GridShowButtons.ShowCurrentRow; break; case "FieldDeviceID": manageDailyAssignments = new ManageDailyAssignments(); FieldDeviceCollection fieldDevices = manageDailyAssignments.FieldDeviceCollection; gridColumns[i].StyleInfo.CellType = "ComboBox"; gridColumns[i].StyleInfo.CellValueType = typeof(string); gridColumns[i].StyleInfo.DisplayMember = "SerialNumber"; gridColumns[i].StyleInfo.ValueMember = "SerialNumber"; gridColumns[i].StyleInfo.DataSource = fieldDevices; gridColumns[i].StyleInfo.DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Editable; gridColumns[i].StyleInfo.ShowButtons = Syncfusion.Windows.Forms.Grid.GridShowButtons.ShowCurrentRow; break; case "LoadGroup": manageDailyAssignments = new ManageDailyAssignments(); WorkAssignmentLoadGroupCollection loadGroups = manageDailyAssignments.LoadGroupCollection; gridColumns[i].StyleInfo.CellType = "ComboBox"; gridColumns[i].StyleInfo.CellValueType = typeof(string); gridColumns[i].StyleInfo.DisplayMember = "LoadGroup"; gridColumns[i].StyleInfo.ValueMember = "LoadGroup"; gridColumns[i].StyleInfo.DataSource = loadGroups; gridColumns[i].StyleInfo.DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Editable; gridColumns[i].StyleInfo.ShowButtons = Syncfusion.Windows.Forms.Grid.GridShowButtons.ShowCurrentRow; break; case "WorkFilterName": manageDailyAssignments = new ManageDailyAssignments(); WorkFilterCollection workFilters = manageDailyAssignments.WorkFilterCollection; gridColumns[i].StyleInfo.CellType = "ComboBox"; gridColumns[i].StyleInfo.CellValueType = typeof(string); gridColumns[i].StyleInfo.DisplayMember = "WorkFilterName"; gridColumns[i].StyleInfo.ValueMember = "WorkFilterName"; gridColumns[i].StyleInfo.DataSource = workFilters; gridColumns[i].StyleInfo.DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Editable; gridColumns[i].StyleInfo.ShowButtons = Syncfusion.Windows.Forms.Grid.GridShowButtons.ShowCurrentRow; break; case "SplitType": manageDailyAssignments = new ManageDailyAssignments(); splitTypes = new ArrayList(); for( int k = 0; k < this.manageDailyAssignments.SplitTypes.Count; k++ ) { //TODO: the ComboBoxItem is in ManageCodes, this may be a useful class to put in a common area splitTypes.Add(new ComboBoxItem(k, manageDailyAssignments.SplitTypes[k].Translation)); } gridColumns[i].StyleInfo.CellType = "ComboBox"; gridColumns[i].StyleInfo.CellValueType = typeof(int); gridColumns[i].StyleInfo.DisplayMember = "DisplayMember"; gridColumns[i].StyleInfo.ValueMember = "ValueMember"; gridColumns[i].StyleInfo.DataSource = splitTypes; gridColumns[i].StyleInfo.DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Editable; gridColumns[i].StyleInfo.ShowButtons = Syncfusion.Windows.Forms.Grid.GridShowButtons.ShowCurrentRow; break; case "WorkSetID": manageDailyAssignments = new ManageDailyAssignments(); WorkSetCollection routes = manageDailyAssignments.GetWorkSetCollections(); gridColumns[i].StyleInfo.CellType = "ComboBox"; gridColumns[i].StyleInfo.CellValueType = typeof(string); gridColumns[i].StyleInfo.DisplayMember = "WorkSetID"; gridColumns[i].StyleInfo.ValueMember = "WorkSetID"; gridColumns[i].StyleInfo.DataSource = routes; gridColumns[i].StyleInfo.DropDownStyle = Syncfusion.Windows.Forms.Grid.GridDropDownStyle.Editable; gridColumns[i].StyleInfo.ShowButtons = Syncfusion.Windows.Forms.Grid.GridShowButtons.ShowCurrentRow; break; case "Cycle": gridColumns[i].StyleInfo.ReadOnly = true; gridColumns[i].StyleInfo.Enabled = false; break; } }


AD Administrator Syncfusion Team June 29, 2004 05:35 PM UTC

A couple of comments on your code. You are setting one style to be ReadOnly, and then immediately trying to set same style to be Enabled = false. Unless you have grid.IgnoreReadOnly set to true while you do this, setting a style readonly will normally prevent it form being modified after that. (ReadOnly also applies to trying to set style properties from code.) So, that Enabled = false may not be being set in your code. One other comment. If you have a column set Enabled = false, then you clicking on that column will not cause the currentcell to move as a disabled cell cannot become the current cell. Is clicking one of these disabled cells when you see the RowLeave and RowEnter events not fire? If so, then that is by design. If this is the case, then you might consider making the cells Static CellType as this would allow them to become the current cell( no Enabled = false setting required), and still not be editable.


AD Administrator Syncfusion Team June 29, 2004 05:44 PM UTC

Thanks. That was it.

Loader.
Live Chat Icon For mobile
Up arrow icon