Declined
Last Updated: 25 Mar 2022 11:39 by Ian
Ian
Created on: 24 Mar 2022 12:43
Category: GridView
Type: Feature Request
0
GridView - default to nothing selected

Eery time I use the GridView, I have to remember to un-select the last item in the list.

This is almost always to wrong thing to be selected - so why select it by default?

..and the way to swith this 'feaure' off isn't obvious - I always have to look it up....RadGridView1.CurrentRow = Nothing

6 comments
Ian
Posted on: 25 Mar 2022 11:39

No problem - I understand the need to protect existing cutomers.

I'm one of them :-)

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 25 Mar 2022 11:29
Hello, Ian,

I am glad that the suggested solution fits your scenario. To be honest the SelectLastAddedRow property was introduced a very long time ago. Its default value has always been true. Changing the default value to false would have a huge impact over all existing projects of our clients. Even though it is just a simple property, it is expected to be a massive change for the existing customers. That is why we would consider improving this behavior in case we receive similar requests from other customers.

Thank you for your understanding.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Ian
Posted on: 25 Mar 2022 10:15

I'm happy that there are ways to avoid this happening - the single line of code does it perfectly.

My only suggestion was that maybe the default for un-bound grids would be not to highlight the last row.

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 25 Mar 2022 10:06
Hello, Ian,

Thank you for specifying that you are using unbound mode. 

I would recommend you to set the MasterTemplate.SelectLastAddedRow property to false. Thus, adding rows programmatically wouldn't manage the CurrentRow in RadGridView
        public RadForm1()
        {
            InitializeComponent();

            this.radGridView1.MasterTemplate.SelectLastAddedRow = false;
            this.radGridView1.Columns.Add("Text");
            this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            for (int i = 0; i < 5; i++)
            {
                this.radGridView1.Rows.Add(Guid.NewGuid().ToString());
            }
        }

I believe that it would fit yoru scenario.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Ian
Posted on: 25 Mar 2022 09:36

Hi Dess,

All my GridViews are populate by data from another system, not using data binding. So I manually create GridViewDataRowInfo instances, and add them to the rows. 

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 25 Mar 2022 08:49

Hello, Ian,

Usually, when the RadGridView.DataSource is set, the current row is synced with the current position in the applied DataSource collection. It is designed and expected behavior. Since it is not clear according to the provided information how RadGridView  is populated with data, could you please elaborate?

A sample code snippet or a runnable project would be greatly appreciated. Setting the CurrentRow property to null after data binding is a good approach for clearing the selection/highlighting.

Thank you in advance for your cooperation. I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.