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

How to make a grid readonly

2 Answers 2614 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 18 Dec 2012, 12:06 AM
Hi there,
I've got a datatype with a RoundID identity column which is generated in the database. This means that it shouldn't be edited, and it will be automatically populated when a new record is added. I would like to display it as read only.
I see from various places that there used to be a .Bound().ReadOnly() method, but this seems to be missing from the latest version. Am I missing something?
If not, can somebody point me in the direction of how to create a custom template or some such to make this work?

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 18 Dec 2012, 03:44 PM
Hi Dave,

You can set editable:false for a particular field in the Model of the data source, as shown in this demo:

http://demos.kendoui.com/web/grid/editing-custom.html

(the code viewer below the Grid shows how to configure a readonly field in MVC as well)

This is also explained in the documentation:

http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/migration/widgets/grid#columns

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Dave
Top achievements
Rank 1
answered on 18 Dec 2012, 09:33 PM
Perfect! Thanks.
Tags
Grid
Asked by
Dave
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Dave
Top achievements
Rank 1
Share this question
or