RadGridView Select all record when click top left corner

5 posts, 2 answers
  1. Firion
    Firion avatar
    4 posts
    Member since:
    Nov 2015

    Posted 12 Nov 2015 Link to this post

    Hi, I would like to ask about the RadGridView to select all row by clicking top left corner like Excel. May I know how to do this?
    Thank you
  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4168 posts

    Posted 16 Nov 2015 Link to this post

    Hello Firion,

    Thank you for writing.

    In order to achieve your goal, please have a look at the following code snippet: 
    public Form1()
    {
        InitializeComponent();
        this.radGridView1.CellClick+=radGridView1_CellClick;
        this.radGridView1.MultiSelect = true;
    }
     
    private void radGridView1_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
    {
        GridTableHeaderCellElement headerCell = sender as GridTableHeaderCellElement;
        if (headerCell!=null )
        {
            this.radGridView1.SelectAll();
        }
    }

    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
  3. Firion
    Firion avatar
    4 posts
    Member since:
    Nov 2015

    Posted 17 Nov 2015 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Thank :) but i prefer the code in vb.net

     

  4. Answer
    Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 17 Nov 2015 Link to this post

    Here you are:
    Public Sub New()
        InitializeComponent()
        AddHandler Me.radGridView1.CellClick, AddressOf radGridView1_CellClick
        Me.radGridView1.MultiSelect = True
    End Sub
     
    Private Sub radGridView1_CellClick(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs)
        Dim headerCell As GridTableHeaderCellElement = TryCast(sender, GridTableHeaderCellElement)
        If headerCell IsNot Nothing Then
            Me.radGridView1.SelectAll()
        End If
    End Sub

    For conversion between C# and VB.NET you can use our free online converter: http://converter.telerik.com/.

    Regards,
    Stefan
    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
  5. Firion
    Firion avatar
    4 posts
    Member since:
    Nov 2015

    Posted 18 Nov 2015 in reply to Stefan Link to this post

    Thank you so much :)
Back to Top