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

Problem with CheckBox Column in GridView

31 Answers 665 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hayley
Top achievements
Rank 1
Hayley asked on 22 Apr 2009, 06:54 AM

Hello,

I have a CheckBox column in a GridView. Since downloading SP1 when you now try check/uncheck the checkbox it does nothing (if the row is not selected) and requires and second click in order to check/uncheck the checkbox. This was working fine prior to SP1, can you please help?

Thanks,

Hayley

31 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 22 Apr 2009, 08:23 AM
Hi Hayley,

You are right that multiple clicks are required, one for focusing the cell and second to enter in edit mode, which is disturbing. We are aware of this unexpected behavior and will fix it in our next release.

Thanks again for pointing this out. I have updated your Telerik points.

All the best,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Hayley
Top achievements
Rank 1
answered on 23 Apr 2009, 04:57 AM
Hi Stefan,

Thanks for your reply. Do you know when the next release will be?

Thanks,

Hayley
0
Stefan Dobrev
Telerik team
answered on 24 Apr 2009, 09:21 AM
Hi Hayley,

We do not have a specific date for the next release, but we are aiming for the middle of the summer. Till then you can check this forum post for a workaround.

Regards,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tyree
Top achievements
Rank 2
answered on 10 May 2009, 04:54 AM
I hope this will also address the multiple clicks needed for buttons to?
0
Vlad
Telerik team
answered on 13 May 2009, 08:52 AM
Hello Tyree,

Fix for this will be released in our upcoming service pack - next week.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kevin
Top achievements
Rank 1
answered on 05 Jun 2009, 06:56 PM
Hello,

I wonder if this problem has been addressed in the latest SP. I tried the May 29 build, but still see the problem.

Thanks,

Kevin
0
Vlad
Telerik team
answered on 09 Jun 2009, 05:52 AM
Hello Kevin,

Indeed the problem is addressed in our current official service pack - you can find small application attached.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kevin
Top achievements
Rank 1
answered on 09 Jun 2009, 04:40 PM
Vlad,

Thanks for the example. It demonstrates one-click checkbox selection works but it does not solve my problem. In my case I have a List of objects. One of the properties of the object is a boolean, and once bound to the grid I have a checkbox column. To check this checkbox, it still requires me to do 3 clicks. In the example you show, the checkbox is not part of the object, so I can't update the object's property and have it automatically reflect on the grid.

Thanks,

Kevin
0
Nedyalko Nikolov
Telerik team
answered on 12 Jun 2009, 11:49 AM
Hi Kevin,

Indeed when you edit boolean property you will need to click twice to put the cell in edit mode and the next click will check the CheckBox. We plan to introduce some modifications for the editing (logic and usability). Our plans are to implement an enum of conditions which will control enter into edit mode behavior.

I cannot commit that this will be available for the next release, but we will do our best in order to supply this as soon as possible. As a workaround you can handle RadGridView.CurrentCellChanged and call RadGridView.BeginEdit() for CheckBox columns.

I'm attaching a sample project for your reference.

Sorry for the inconvenience caused.

Greetings,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kevin
Top achievements
Rank 1
answered on 12 Jun 2009, 01:37 PM
Hi Nedyalko,

Thanks for the example. I added a boolean property to the Person class to add a checkbox column to the grid. However, it still requires 2 clicks to get the box checked/unchecked. Although this workaround has save you one click (from 3 down to 2), it could potentially cause the Grid to freeze as the event CurrentCellChanged gets fired when any cell on the grid get changed. This is especially true when Multiselect is turned on and your code performs some update to cells on the selected rows.

Thanks,

Kevin
0
Nedyalko Nikolov
Telerik team
answered on 17 Jun 2009, 11:00 AM
Hello Kevin,

Indeed this example is just a workaround which is far from the perfect solution.  We scheduled improvements to editing logic and UI usability just after next official release, which means that you can get them soon after that.

I'll send you "latest internal build" as soon as this enhancement is ready.

Don't hesitate to contact us if you have other questions.

Greetings,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ludovic Gerbault
Top achievements
Rank 1
answered on 04 Aug 2009, 08:54 AM
Hello,

We're facing today a similar problem.
We've upgraded our project to the Q2 SL3 version, and using a celltemplate and celledittemplate to bind a checkbox on a gridview column, but we still need to click like 3 times to get the checkbox checked.

I thought this issue would be fixed in this version. Maybe there's a particular way to activate this functionality that I'm not aware of.

Anyway, could you please tell us how to check this box on a single click ?
0
Vlad
Telerik team
answered on 04 Aug 2009, 09:11 AM
Hello,

You can declare desired CheckBox in CellTemplate directly instead of CellEditTemplate to achieve your goal.

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ludovic Gerbault
Top achievements
Rank 1
answered on 04 Aug 2009, 09:34 AM
That's the problem exactly.

The checkbox is already declared in the CellTemplate.

Here's the code snippet of the declaration:

 <grid:RadGridView x:Name="rgvConsultation" 
                              IsReadOnly="True" 
                              AutoGenerateColumns="False" 
                              Grid.Row="6" 
                              ColumnsWidthMode="Fill" 
                              ScrollMode="RealTime" 
                              RowIndicatorVisibility="Collapsed"
                              Margin="0,10"
                              ShowColumnFooters="True"
                              RowDetailsVisibilityMode="VisibleWhenSelected"
                              ScrollViewer.VerticalScrollBarVisibility="Visible"
                              RowLoaded="rgvConsultation_RowLoaded">

[... Other columns declaration...]
<grid:GridViewDataColumn x:Name="chbPointage"
                                             Width="Auto"
                                             TextAlignment="Center">
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="chBoxPointage" 
                                      Visibility="Collapsed"
                                      Loaded="chBoxPointage_Loaded"
                                      HorizontalAlignment="Center"/>
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                    </grid:GridViewDataColumn>

And it still needs 3 clicks to check the box.
0
Kevin
Top achievements
Rank 1
answered on 04 Aug 2009, 02:30 PM
Hello,

I have tried to use CellTemplate ins SL3 and it seems to work as expected. Here is my DataTemplate:

                    <DataTemplate>
                            <CheckBox x:Name="chBoxPointage" 
                                     IsChecked="{Binding BOOL_VAL, Mode=TwoWay}"
                                      HorizontalAlignment="Center"/>
                        </DataTemplate>

The only different is that IsChecked is bound within the xaml vs yours binding probably in the checkbox's loaded event. However, it shouldn't matter. Try the plain checkbox (without any loaded event or anything inside) to see if you can achieve one-click selected.

Thanks,

Kevin
0
Celeste
Top achievements
Rank 1
answered on 06 Oct 2009, 03:06 PM
Hi:

I am using a Checkbox inside Column.CellTemplate, and now it's only necesary one click. But I need when I set column.IsReadOnly = true, checkbox set enables to false. How can I do? Because column.IsReadOnly does not work.

Celeste.
0
Nedyalko Nikolov
Telerik team
answered on 08 Oct 2009, 12:23 PM
Hello Celeste,

We intend to introduce IsEnabled property of the GridViewColumn in order to make this task a little bit easier. Unfortunately I cannot commit with any specific date or release.
Meanwhile you can take a look at this online example.
Hope this helps.

All the best,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kevin Happe
Top achievements
Rank 1
answered on 04 Jun 2010, 06:46 PM
I am using 2010 1 quarter sp2.

I want the user to be able to single click a checkbox in a column and have the checkbox switch from checked to unchecked.
I do not want the user to have to click twice.  (First click to put it in edit mode and the second click to change the checkbox.)

So how would I implement this behavior in the current release.  Another caviat  is that I have to add the columns dynamically in code behind and not in the xaml.

Thanks
Kevin
0
Nedyalko Nikolov
Telerik team
answered on 09 Jun 2010, 01:27 PM
Hello Kevin Happe,

You can use code similar to this:
GridViewCheckBoxColumn col = new GridViewCheckBoxColumn();
col.AutoSelectOnEdit = true;
 
this.radGridView.Columns.Add(col);

I hope this will help.

Sincerely yours,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
vidya
Top achievements
Rank 1
answered on 20 Jun 2010, 11:30 PM
I cannot find GridViewCheckBoxColumn . Please help.

Thanks
0
Vlad
Telerik team
answered on 21 Jun 2010, 06:19 AM
Hello,

 Do you have our latest service pack - Q1 2010 SP2? 

All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kevin Happe
Top achievements
Rank 1
answered on 22 Jun 2010, 02:29 PM
Even when I add the Checkboxcolumn and set AutoSelectOnEdit to true.  I still have to click twice.  Is there an edit trigger that I need to be using?
0
Tsvyatko
Telerik team
answered on 25 Jun 2010, 12:36 PM
Hi Kevin Happe,

Unfortunately, this property work only when the corresponding row is already in edit mode. I have prepared simple project with behavior class attached to the grid that enables the desired functionality - single click on the checkbox column will change the checkbox state. Currently we are planning to make this behavior default for this column.

Please have a look at attachment and let me know if this work for you.

Kind regards,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
gjm
Top achievements
Rank 1
answered on 07 Jul 2010, 09:59 PM
How do I do this at runtime? I mean when binding the grid at runtime
0
Tsvyatko
Telerik team
answered on 12 Jul 2010, 08:06 AM
Hello Gopi Menon,

I have modified the sample application to work when setting itemsSource to the grid at run-time. Please check the attachment and let me know if you need any further assistance.

Sincerely yours,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
gjm
Top achievements
Rank 1
answered on 23 Jul 2010, 10:16 PM
Sorry for not being clear. I am actually creating my grid at runtime. I dont it on my xaml.

Thanks,
Gopi
0
Tsvyatko
Telerik team
answered on 28 Jul 2010, 08:37 AM
Hello Gopi Menon,

Please, check the attachment. It contains the modified example demonstrating how to create the grid in code behind in this case. Let me know if you have any other questions.

Kind regards,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stuart
Top achievements
Rank 1
answered on 05 Oct 2010, 02:31 PM
Hi

I've tried AutoSelectOnEdit="True" but I too have to click twice before my checkboxes register the change.

Is there anything else I need to do?

Thanks

0
Joachim
Top achievements
Rank 1
answered on 06 Oct 2010, 08:59 AM
Hi Telerik Team !

I have the same problem with the last release when i want to click on a button within a column i have to click twice :
the first time to set the focus, the second time to push the button O_o ??

In advance thanks for your help guys.

Joachim.
0
Juliana
Top achievements
Rank 1
answered on 06 Oct 2010, 09:21 AM
Hi,

I declare checkbox column like that

<telerikGrid:GridViewCheckBoxColumn EditTriggers="CellClick" AutoSelectOnEdit="True" />

And it works perfectly, no need in second click. Just check for this two options.

HTH,
Juliana.
0
Stuart
Top achievements
Rank 1
answered on 07 Oct 2010, 03:22 PM
Brilliant! Fixes it for me.
Tags
GridView
Asked by
Hayley
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Hayley
Top achievements
Rank 1
Tyree
Top achievements
Rank 2
Vlad
Telerik team
Kevin
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Ludovic Gerbault
Top achievements
Rank 1
Kevin
Top achievements
Rank 1
Celeste
Top achievements
Rank 1
Kevin Happe
Top achievements
Rank 1
vidya
Top achievements
Rank 1
Tsvyatko
Telerik team
gjm
Top achievements
Rank 1
Stuart
Top achievements
Rank 1
Joachim
Top achievements
Rank 1
Juliana
Top achievements
Rank 1
Share this question
or