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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Deleting multiple records in grouping grid

Thread ID:





28561 May 4,2005 04:43 PM UTC May 5,2005 07:42 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On May 4, 2005 04:43 PM UTC

1. I use GridSelectionFlags.Any for my grouping grid. I have noticed that if you select a row range (as opposed to a cell range) and then press the delete button, all the selected rows are deleted. I would like to also implement this behaviour when the user presses a button. Is there a simple way to trigger this behaviour from code? If there is no direct way to trigger this behaviour, I guess it can be done using the info in TableControl.Selections.GetSelectedRows. However, I found it difficult to figure out how to get from the selection indexes to the actual records. If there are no easier way, can you give an example of how to do this? 2. Another question. How can I limit the number of characters in a text column? (I have a database column that allows, say, max 16 characters. If the user enters a longer text it is truncated without warning when it is saved to the DB. I would thus like prevent the user from entering more characters in the grid.)

Administrator [Syncfusion]
Replied On May 4, 2005 05:21 PM UTC

The simplest thing to do is to send the Delete key to the grid using SendKeys if that will work for you. Here is a button handler that tries this.
private void button1_Click(object sender, System.EventArgs e)
	if(this.gridGroupingControl1.TableModel.Selections.GetSelectedRows(true, false).Count > 0)
To control the input length of a TextBox cell, try setting: this.gridGroupingControl1.TableDescriptor.Columns["Col1"].Appearance.AnyRecordFieldCell.MaxLength = 15;

Administrator [Syncfusion]
Replied On May 4, 2005 07:38 PM UTC

I was not able to make this work. It seems like the grid never receives the key. When I sent the delete key using the code above, the TableControlCurrentCellKeyDown event handler was never called. On the other hand, if I press the Del key from the keyboard (or any other key) the TableControlCurrentCellKeyDown is called. I also tried to send the Del key to a text box on the same form with the code and this workes fine. Any ideas why this doesn''t work for the grouping grid? The solution for max text length worked fine. Thanks.

Administrator [Syncfusion]
Replied On May 4, 2005 07:46 PM UTC

Since you are doing this from a menu item, try calling Validate on the form before sending the key. this.Validate();// here this refers to the form this.gridGroupingControl1.Focus(); SendKeys.Send("{DEL}");

Administrator [Syncfusion]
Replied On May 5, 2005 07:42 AM UTC

I think I found the solution. The problem was with the Focus statement. Setting the focus to the TableControl instead of the GridControl itself solved the problem (don''t ask me why!): this.gridControl1.TableControl.Focus();


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon