Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

SelectAll method giving error in HeaderCellToggleStateChanged

$
0
0
Hello Lokesh,

Thank you for writing.

I confirm that it is an issue with RadGridView. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to select manually each row without Begin/EndUpdate block which will refresh the whole grid:
private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e)
{
    bool selected = e.State.ToString() == "On";
 
    foreach (GridViewRowInfo r in this.radGridView1.Rows)
    {
        r.IsSelected = selected;
    }
}

An alternative solution is to use the MouseUp event:
private void radGridView1_MouseUp(object sender, MouseEventArgs e)
{
    RadCheckBoxElement el = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as RadCheckBoxElement;
    if (el!=null)
    {
        GridCheckBoxHeaderCellElement headerCell = el.Parent as GridCheckBoxHeaderCellElement;
        bool selected = el.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On;
        if (headerCell!=null)
        {
            if (selected)
            {
                this.radGridView1.SelectAll();
            }
            else
            {
                this.radGridView1.ClearSelection();
            }
        }
    }
}

I hope this information helps. Should you have further questions, I would be glad to help.
 
Regards,
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items

Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>