This is a migrated thread and some comments may be shown as answers.
GridView - Disable the selection only for the end-user
3 Answers 6 Views
This is a migrated thread and some comments may be shown as answers.
Hu
Top achievements
Rank 1
Veteran
Hu asked on 02 Jun 2020, 06:33 AM

Hello,

Please, may we disable the selection of a row only for the end-user?  It will need to be possible to manipulate the selection programmatically.

Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Nadya
Telerik team
answered on 04 Jun 2020, 10:26 AM

Hello Hu,

RadGridView offers SelectionMode property that controls whether and how the cell in the grid can be selected. GridViewSelectionMode can be CellSelect, FullRowSelect or None. More information is available here. Following your requirement, you would like to disable selection only for the end-users but still be able to select programmatically.

You can achieve this behavior by handling the SelectionChanging event which allows you to be canceled. Thus, you can raise a flag of boolean type and manage the selection in the grid as per your requirement. I created a sample project for your reference where selection is disabled when the raised flag is true and enabled when the flag is false ( for example when selecting a row programmatically on a button_Click event )

I hope this helps. Let me know if you have other questions.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Hu
Top achievements
Rank 1
Veteran
answered on 09 Jun 2020, 10:27 AM

Dear Nadya,

Thanks for your reply. 

Your answer and sample project were very useful to solve the issue. 

In fact, I was using Current rows properties (and not Selected as mentioned in the post). In any case, I use same approach as you described and was able to disable Current row for the end-user.

Regards

0
Nadya
Telerik team
answered on 09 Jun 2020, 03:22 PM

Hello Hu,

I am glad that the suggested solution helps to resolve the problem that you had. If you need any further assistance do not hesitate to contact us.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Asked by
Hu
Top achievements
Rank 1
Veteran
Answers by
Nadya
Telerik team
Hu
Top achievements
Rank 1
Veteran
Share this question
or