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

RadGridView Select all record when click top left corner

4 Answers 520 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Firion
Top achievements
Rank 1
Firion asked on 12 Nov 2015, 09:33 AM
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

4 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Nov 2015, 10:58 AM
Hello ,

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
0
Firion
Top achievements
Rank 1
answered on 17 Nov 2015, 08:15 AM

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

 

0
Accepted
Stefan
Telerik team
answered on 17 Nov 2015, 09:15 AM
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
0
Firion
Top achievements
Rank 1
answered on 19 Nov 2015, 03:45 AM
Thank you so much :)
Tags
GridView
Asked by
Firion
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Firion
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or