This is a migrated thread and some comments may be shown as answers.

Checkbox List Column

10 Answers 276 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 18 Nov 2011, 09:41 PM
How do I add a checkbox list column to the WinForms GridView control?

Thank you,
Jeff

10 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 23 Nov 2011, 12:22 PM
Hi Jeff, 

Thank you for writing.

To add a check box column to RadGridView, simply create an instance of GridViewCheckBoxColumn and add that instance to the Columns collection of RadGridView

Here is a link to the online documentation concerning this column: http://www.telerik.com/help/winforms/gridview-columns-gridviewcheckboxcolumn.html.

I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

0
Jeff
Top achievements
Rank 1
answered on 23 Nov 2011, 01:38 PM
Stefan,

Thanks for your response, but I was actually looking for a CheckBoxList column instead of a single checkbox.

Any idea on a "checkbox list" column?

Thank you,
Jeff
0
Nikolay
Telerik team
answered on 30 Nov 2011, 08:28 AM
Hi Jeff,

This is to inform you that are currently working on your case. We will get back to you soon.

All the best,
Nikolay
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

0
Nikolay
Telerik team
answered on 01 Dec 2011, 05:02 PM
Hello Jeff,

Thank you for your patience.

Generally, the case of having a multiple checkbox column implies having a RadDropDownListEditor with checked items, because of the big area that will be consumed by the checkboxlists. Still, please find attached a sample project which demonstrates the scenario you desire - a CheckBoxList column.

Please note, however, that such a solution is not recommended to be used in RadGridView. As you will see yourself, the fact that there are many additional elements and layouts in the RadGridView cells, makes the process of scrolling up and down slow.

I am attaching the performance-wise solution, where just one RadDropDownEditor is displayed upon user request. You will notice that this solution makes RadGridView much more responsive and you are still able to select multiple items from a checked (drop-down) list.

I hope this helps. Feel free to write back if you have additional questions.

All the best,
Nikolay
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

0
Daniel
Top achievements
Rank 1
answered on 21 Jan 2013, 08:37 AM
Hello.

Really nice example, I have used such custom control i my solution, but after update to Q3 version it stopped work :(

Also Your example doesn't work.

Drop down items are empty (see attachment) and its generates some exceptions:

System.InvalidOperationException was unhandled
Message="Zmodyfikowano kolekcję. Nie można wykonać operacji wyliczania."
Source="mscorlib"
StackTrace:
w System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
w Telerik.WinControls.RadElementCollection.RadElementEnumerator.MoveNext()
w Telerik.WinControls.UI.DefaultListControlStackContainer.ForceVisualStateUpdate()
w Telerik.WinControls.UI.RadListElement.EndUpdate()
w Telerik.WinControls.UI.RadListElement.set_DataSource(Object value)
w Telerik.WinControls.UI.RadDropDownListElement.set_DataSource(Object value)
w RadMultiSelectDropDownInGrid.Form1.radGridView1_EditorRequired(Object sender, EditorRequiredEventArgs e) w C:\software\telerik\sample\RadMultiSelectDropDownInGrid\RadMultiSelectDropDownInGrid\Form1.cs:wiersz 112
w Telerik.WinControls.UI.EventDispatcher.RaiseEvent[T](Object eventKey, Object sender, T args)
w Telerik.WinControls.UI.GridViewEditManager.GetDefaultEditor(IEditorProvider provider)
w Telerik.WinControls.UI.GridViewEditManager.BeginEdit()
w Telerik.WinControls.UI.GridViewEditManager.OnPositionChanged(PositionChangedEventArgs args)
w Telerik.WinControls.UI.GridViewEditManager.Telerik.WinControls.UI.IGridViewEventListener.ProcessEvent(GridViewEvent eventData)
w Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(GridViewEvent gridEvent, PriorityWeakReferenceList list, GridEventProcessMode processMode)
w Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(GridViewEvent gridEvent)
w Telerik.WinControls.UI.GridViewSynchronizationService.FlushEvents()
w Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewEvent gridEvent)
w Telerik.WinControls.UI.GridViewSynchronizationService.RaiseCurrentChanged(GridViewTemplate template, GridViewRowInfo row, GridViewColumn column, Boolean user)
w Telerik.WinControls.UI.BaseGridNavigator.SelectCore(GridViewRowInfo row, GridViewColumn column)
w Telerik.WinControls.UI.GridRowBehavior.SelectPositionOnMouseDownLeft(MouseEventArgs e, GridRowElement rowElement, GridCellElement cellElement)
w Telerik.WinControls.UI.GridRowBehavior.OnMouseDownLeft(MouseEventArgs e)
w Telerik.WinControls.UI.GridRowBehavior.OnMouseDown(MouseEventArgs e)
w Telerik.WinControls.UI.BaseGridBehavior.OnMouseDown(MouseEventArgs e)
w Telerik.WinControls.UI.RadGridView.OnMouseDown(MouseEventArgs e)
w System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
w System.Windows.Forms.Control.WndProc(Message& m)
w Telerik.WinControls.RadControl.WndProc(Message& m)
w System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
w System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
w System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
w System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
w System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
w System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
w RadMultiSelectDropDownInGrid.Program.Main() w C:\software\telerik\sample\RadMultiSelectDropDownInGrid\RadMultiSelectDropDownInGrid\Program.cs:wiersz 18
w System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
w Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
w System.Threading.ThreadHelper.ThreadStart()
InnerException:

 

0
Nikolay
Telerik team
answered on 23 Jan 2013, 12:14 PM
Hello Daniel,

Please refer to the following knowledge base article which demonstrates how to achieve the desired behavior with our latest version: Mutiselect drop down list column in RadGridView.

At the bottom of the article, you will find sample projects in C# and VB.NET that would allow you to incorporate the proposed solution in your application more easily.

I hope this helps.

Greetings,
Nikolay
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Daniel
Top achievements
Rank 1
answered on 23 Jan 2013, 01:09 PM
Hello

I'm afraid it's not the same problem.

In Your example whole column is as custom (multi select) column.

 I need different editors type in one column (dependent on values in other columns). That was possible in RadMultiSelectDropDownInGrid project.
0
Nikolay
Telerik team
answered on 28 Jan 2013, 01:25 PM
Hi Daniel,

I modified the project from the Knowledge Base article and now you can use the multi-select editor only in a selected set of cells of a column. Please find the attached project for additional information.

I hope this helps.

All the best,
Nikolay
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Daniel
Top achievements
Rank 1
answered on 29 Jan 2013, 01:36 PM
Hello.

Yes, that is what I need! :)

Thank You.
0
Andrey Kipetcoff
Top achievements
Rank 1
answered on 23 Aug 2013, 05:51 PM
Thank you, guys. Very useful control.
Tags
GridView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Jeff
Top achievements
Rank 1
Nikolay
Telerik team
Daniel
Top achievements
Rank 1
Andrey Kipetcoff
Top achievements
Rank 1
Share this question
or