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

User update multiple rows in virtual grid. .

I am using the SaveCellInfo event in a virtual grid to save information from a user change in the grid back into my data structure. A bunch of users want to replicate some excel functionality. Here are the steps in Excel: 1. Highlight cells A1:A5 2. Enter the value "abc" (it will show up in the cell A1. 3. Hit Cntl + Enter and "abc" is put in all cells from A1 to A5. So this is basically a shortcut to update 1 column in multiple rows at once. I want to replicate this in the virtual syncfusion grid. The issue is the that GridSaveCellInfoEventArgs has a rowIndex property. I essentially want this event to fire for all appropriate rows i guess. Please let me know if you have any suggestions. thanks, ak

5 Replies

AD Administrator Syncfusion Team April 11, 2006 09:26 AM UTC

Hi Adam, The indent behaviour can be achieved by using the CurrentCellKeyDown event. In this event, get the range information and accordingly fill it with the currentcell data on the corresponding key down. Code Snippet : private void gridControl1_CurrentCellKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if ((e.KeyCode == Keys.Enter)&&(ModifierKeys & Keys.Control)!=0) { GridCurrentCell cc = this.gridControl1.CurrentCell; GridRangeInfo info = this.gridControl1.Selections.Ranges.ActiveRange; for(int i = info.Top; i<=info.Bottom ;i++) for(int j = info.Left; j<= info.Right;j++) this._extData[i-1,j-1] = int.Parse(cc.Renderer.ControlText); this.gridControl1.Refresh(); } } Best regards, Madhan


AK Adam K. April 12, 2006 03:55 AM UTC

Madhan, In your code, what is this._extData[i-1,j-1]. I am assuming this is your external data structure. I would like to have the code follow the SaveCellinfo code path so nothing else in the chain has to change. Any ideas. thks, ak >Hi Adam, > >The indent behaviour can be achieved by using the CurrentCellKeyDown event. In this event, get the range information and accordingly fill it with the currentcell data on the corresponding key down. > >Code Snippet : >private void gridControl1_CurrentCellKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) >{ > if ((e.KeyCode == Keys.Enter)&&(ModifierKeys & Keys.Control)!=0) > { > GridCurrentCell cc = this.gridControl1.CurrentCell; > GridRangeInfo info = this.gridControl1.Selections.Ranges.ActiveRange; > for(int i = info.Top; i<=info.Bottom ;i++) > for(int j = info.Left; j<= info.Right;j++) > this._extData[i-1,j-1] = int.Parse(cc.Renderer.ControlText); > this.gridControl1.Refresh(); > } >} > >Best regards, >Madhan


AD Administrator Syncfusion Team April 12, 2006 09:31 AM UTC

Hi Adam, Please try using the following code snippet and let us know if this helps. this.gridControl1[i,j].CellValue = int.Parse(cc.Renderer.ControlText) Best regards, Madhan


AK Adam K. April 16, 2006 09:04 PM UTC

Madhan, this is very close. It seems to be firing the SaveCellinfo for each of the rows so all the dat is being updating. The only issue is that the current cell that i am actually typing in doesn''t commit. it shows the value i typed in but i have to hit enter again to commit to that cell. Any ideas? thks, ak >Hi Adam, > >Please try using the following code snippet and let us know if this helps. > >this.gridControl1[i,j].CellValue = int.Parse(cc.Renderer.ControlText) > >Best regards, >Madhan >


AD Administrator Syncfusion Team April 17, 2006 07:44 AM UTC

Hi Adam, Refer to the following sample which, demonstrates the currentcell being saved along with the other cells. Please give us some more details on this issue. Sample : VirtualGrid Thanks for being patience. Best regards, Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon