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

Check/Uncheck grid header checkbox on row click in windows

2 Answers 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 07 May 2018, 11:17 AM

Hi Team,

I'm using telerik grid in one of my windows form. First column is a GridViewCheckBoxColumn and it has checkbox in the header column as well and user can check/uncheck every row manually either by clicking on the checkbox or anywhere on the row(I've written code on the CellClick event to check/uncheck the checkbox). The header checkbox behaves fine if I check/uncheck the row's checkbox but if I click on row it won't check/uncheck the header checkbox. Below is the code written in Cellclick event of the grid:

private void dgvManageBill_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
    if (e.RowIndex >= 0 && dgvManageBill.CurrentRow != null)
    {
        if (e.Column.Name != "columnSelectAll")
        {
            dgvManageBill.CurrentRow.Cells["columnSelectAll"].Value = !Convert.ToBoolean(dgvManageBill.CurrentRow.Cells["columnSelectAll"].Value);
        }
    }
}

 

I thought of accessing the row's checkbox object and then setting its checked state instead of setting the cell value but I'm unable to find the checkbox in the cell. Is there any other way to achieve above requirement? I've been stuck on this quite a long now, will really appreciate some help!

Thanks

Amit

 

 

 

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 10 May 2018, 09:33 AM
Hello Amit,

Please note that this is the UI for SIlverlight forum. May I ask you to post your question in the UI for WinForms forum section?

Thank you for the cooperation.

Regards,
Martin Ivanov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Amit
Top achievements
Rank 1
answered on 10 May 2018, 10:42 AM
Thanks Martin, I've posted in that thread.
Tags
GridView
Asked by
Amit
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Amit
Top achievements
Rank 1
Share this question
or