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

Boolean checkbox column and 3 clicks to edit.

4 Answers 366 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeremy Pryor
Top achievements
Rank 1
Jeremy Pryor asked on 21 Dec 2009, 11:20 PM
I have a grid view that is bound to a boolean data type.  This produces a checkbox in every row.  I want this checkbox to be editable and it works.  However, the users do not like the fact that they must first, click on a row, then click on the checkbox cell to get it into edit mode and then click on it to change the value in the checkbox.  Is there anyway to reduce this down to Select the row and then click the checkbox, in other words once I select a row, is there some code I can use to automatically place this column into edit mode?

4 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 22 Dec 2009, 10:12 AM
Hello Jeremy Pryor,

Checkbox cell becomes editable and changes their value when you click on it with the mouse, regardless of the row state (selected or not). It follows exactly the behavior you want to achieve. Maybe, you are using an old version of RadGridView or you have some custom logic in your application? Nevertheless, you can put a row in edit mode at any time by calling BeginEdit method. I hope this helps. If you need further assistance, please write back.

Regards,
Jack
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
Pooran
Top achievements
Rank 1
answered on 04 Jan 2010, 06:10 AM

Fixed it with following code.

<telerik:GridViewDataColumn UniqueName="IsSelected" DataMemberBinding="{Binding IsSelected, Mode=TwoWay}" Header="" Width="30" > 
                            <telerik:GridViewDataColumn.CellTemplate> 
                                <DataTemplate> 
                                    <CheckBox IsChecked="{Binding IsSelected}"/>  
                                </DataTemplate> 
                            </telerik:GridViewDataColumn.CellTemplate> 
                            <telerik:GridViewDataColumn.CellEditTemplate> 
                                <DataTemplate> 
                                    <CheckBox Loaded="Editor_Loaded" IsChecked="{Binding IsSelected, Mode=TwoWay}" /> 
                                </DataTemplate> 
                            </telerik:GridViewDataColumn.CellEditTemplate> 
                        </telerik:GridViewDataColumn> 

private void Editor_Loaded(object sender, RoutedEventArgs e)  
        {  
            Control ctrl = sender as Control;  
            if (ctrl != null)  
            {  
                ctrl.Focus();  
            }  
        } 

Source :  http://demos.telerik.com/wpf/?GridView/CellEditTemplate
Hope it helps :)
Pooran
0
Rob
Top achievements
Rank 1
answered on 06 May 2010, 04:37 PM
if I click on a boolean datagrivew column (Tick it) but I don't click away from the tick box.
The row is highlighted and the tickbox is ticked, however when I run radgridview1.row(x).cells("tickColumn").Value, it always comes back as "False"
However if I click on another row to lose focus, it then comes back as "True" which is right now.

I use Winforms Q1 2010 version of Telerik.Wincontrols.Gridview 2010.1.10.409


Dim

 

i As Integer

 

 

For i = 0 To DGEmployees.RowCount - 1

 

 

    If DGEmployees.Rows(i).Cells(0).Value = True Then

 

 

        Dim sSQL As String = ""

 

        sSQL =

"exec PEdb.dbo.sp_HideReconcileData " + CStr(DGEmployees.Rows(i).Cells("HRID").Value) 
        
RunInsertUpdateDelete(sSQL)

 

 

    else
    ' It Always hits this line if only one row is ticked and still has focus
    End
If

 

 

Next

 

0
Jack
Telerik team
answered on 12 May 2010, 09:31 AM
Hi Peter,

This is the desired behavior in RadGridView. The data is updated when you change the current cell or row. You can change this behavior by calling EndEdit method when handling ValueChanged event:

void radGridView1_ValueChanged(object sender, EventArgs e)
{
    if (sender is RadCheckBoxEditor)
    {
        this.radGridView1.EndEdit();
    }
}

I hope this helps.

 

Kind regards,
Jack
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.
Tags
GridView
Asked by
Jeremy Pryor
Top achievements
Rank 1
Answers by
Jack
Telerik team
Pooran
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Share this question
or