gridGroupingControl1 Copy/Paste

In my gridGroupingControl, i have rows like that: (Row3 is calculated from Row2/Row1,Row 6 is calculate from Row5/Row4, User also can key Row3 and Row 6, ): Row1 10 20 30 Row2 2 5 6 Row3 20% 25% 20% Row4 20 20 40 Row5 4 5 8 Row6 20% 25% 20% I have to question below: 1.now, I using TableControlCurrentCellAcceptedChanges to handle it,if Row1 or Row2 changed,i can calculate Row3 and Row6 in this event.But copy/past do not hire this event,how can i do to let paste(Ctrl+V) row3=row2/row1 and Row6=Row5/Row4? 2. i use Model_QueryCellFormattedText/Model_SaveCellFormattedText to format Row3 and Row6 in Model_QueryCellFormattedText //if is row3 or Row 6 double d; if(double.TryParse(e.Style.Text, System.Globalization.NumberStyles.Any, null, out d)) { //e.Text = e.Style.Text + " %"; d=d*100; d=System.Math.Round(d,2); e.Text = d.ToString() + "%"; e.Style.Format="###0.##%"; e.Handled = true; } in Model_SaveCellFormattedText //if Row3 or row6 if(e.Text.EndsWith("%")) { e.Style.Text = e.Text.Substring(0, e.Text.Length - 1); e.Handled = true; } break; , If i Copy row3 to row 6:(copy 20% ,but paste is 2000% )How can i handle it?

1 Reply

AD Administrator Syncfusion Team July 29, 2005 01:32 PM UTC

Hi Cradle, in your Model_SaveCellFormattedText you can convert the string into a number, e.g. double d; if (double.TryParse(e.Text.Substring(0, e.Text.Length - 1), out d) { e.Style.CellValue = d/100; e.Handled = true; } Stefan >In my gridGroupingControl, > >i have rows like that: >(Row3 is calculated from Row2/Row1,Row 6 is calculate from Row5/Row4, User also can key Row3 and Row 6, >): >Row1 10 20 30 >Row2 2 5 6 >Row3 20% 25% 20% >Row4 20 20 40 >Row5 4 5 8 >Row6 20% 25% 20% > >I have to question below: >1.now, I using TableControlCurrentCellAcceptedChanges to handle it,if Row1 or Row2 changed,i can calculate Row3 and Row6 in this event.But copy/past do not hire this event,how can i do to let paste(Ctrl+V) row3=row2/row1 and Row6=Row5/Row4? >2. i use Model_QueryCellFormattedText/Model_SaveCellFormattedText to format Row3 and Row6 > >in Model_QueryCellFormattedText >//if is row3 or Row 6 >double d; > if(double.TryParse(e.Style.Text, System.Globalization.NumberStyles.Any, null, out d)) > { > //e.Text = e.Style.Text + " %"; > d=d*100; > d=System.Math.Round(d,2); > e.Text = d.ToString() + "%"; > e.Style.Format="###0.##%"; > e.Handled = true; > } > >in Model_SaveCellFormattedText >//if Row3 or row6 >if(e.Text.EndsWith("%")) > { > e.Style.Text = e.Text.Substring(0, e.Text.Length - 1); > e.Handled = true; > } > break; > >, >If i Copy row3 to row 6:(copy 20% ,but paste is 2000% )How can i handle it? >

Loader.
Up arrow icon