Two NumericUpDown control ina single cell

Hi Clay, Is it possible to have a two NumericUpDown Control in a single cell?.. Thiyagu.

2 Replies

AD Administrator Syncfusion Team November 2, 2004 05:55 AM UTC

If you want just one cell like this (so no control sharing across multiple grid cells), then the easiest thing to do is to create a panel that holds your two instances of NumericUpDowns, an dthen use the Control cellType to display the panel in a cell. Below is some code. If you want to have this control in several cells, then you would have to derive a cell control to do this. One way to do this is shown in the Grid\Samples\In Depth\DropDownFormAndUserControlSample sample. Panel box = new Panel(); NumericUpDown ud1 = new NumericUpDown(); NumericUpDown ud2 = new NumericUpDown(); //stack them from the left ud1.Dock = DockStyle.Left; ud2.Dock = DockStyle.Left; ud1.Width = 30; ud2.Width= 30; ud1.BorderStyle = BorderStyle.FixedSingle; ud2.BorderStyle = BorderStyle.FixedSingle; box.Controls.AddRange(new Control[]{ud1, ud2}); box.BorderStyle = BorderStyle.None; gridControl1.RowHeights[2] = 20; gridControl1.ColWidths[2] = 64; gridControl1[2,2].CellType = "Control"; gridControl1[2,2].Control = box; this.Controls.Add(box);


TH Thiyagu November 2, 2004 06:38 AM UTC

Thanks Clay. Thank you very much. >If you want just one cell like this (so no control sharing across multiple grid cells), then the easiest thing to do is to create a panel that holds your two instances of NumericUpDowns, an dthen use the Control cellType to display the panel in a cell. Below is some code. > >If you want to have this control in several cells, then you would have to derive a cell control to do this. One way to do this is shown in the Grid\Samples\In Depth\DropDownFormAndUserControlSample sample. > > > >Panel box = new Panel(); >NumericUpDown ud1 = new NumericUpDown(); >NumericUpDown ud2 = new NumericUpDown(); >//stack them from the left >ud1.Dock = DockStyle.Left; >ud2.Dock = DockStyle.Left; >ud1.Width = 30; >ud2.Width= 30; >ud1.BorderStyle = BorderStyle.FixedSingle; >ud2.BorderStyle = BorderStyle.FixedSingle; >box.Controls.AddRange(new Control[]{ud1, ud2}); > >box.BorderStyle = BorderStyle.None; >gridControl1.RowHeights[2] = 20; >gridControl1.ColWidths[2] = 64; >gridControl1[2,2].CellType = "Control"; >gridControl1[2,2].Control = box; >this.Controls.Add(box); >

Loader.
Up arrow icon