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

[Solved] Setting Telerik MVC grid column properties during an Edit‏

2 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bill
Top achievements
Rank 2
Bill asked on 24 Oct 2011, 06:13 PM

I'm using MVC 3 with Razor. I have an Edit comand on the row of the grid.

When a user clicks on Edit (this places the grid in Edit mode with an Update and Cancel button), I want to set a property for two of the columns to readonly. The reason for this is because these two columns are unique to my table and am using the same View for an Insert as well. The Insert will not have these columns set to read only.

When the user clicks on Cancel or Update, I want to set the columns back to the original properties.

I know there must be some properties in the controller I should be able to set when the Edit button is pressed for this, but have not seen any docs on how to accomplish this.

How can I do this?

2 Answers, 1 is accepted

Sort by
0
Derrick
Top achievements
Rank 1
answered on 02 Dec 2011, 04:42 AM
I also need to know how to do this. The requirement I have is also to have a column set as readonly in edit mode, but editable in insert mode. Please advise.
0
Petur Subev
Telerik team
answered on 05 Dec 2011, 02:19 PM
Hi Derrick,

You need to handle the OnEdit client event and set the readonly attribute to the input elements you want to set as read only.
For convenience I attached a sample project which implements this scenario.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
Bill
Top achievements
Rank 2
Answers by
Derrick
Top achievements
Rank 1
Petur Subev
Telerik team
Share this question
or