This is a migrated thread and some comments may be shown as answers.
EditorFor is read only
4 Answers 77 Views
This is a migrated thread and some comments may be shown as answers.
Kory
Top achievements
Rank 1
Kory asked on 05 May 2014, 04:15 PM

Hi, I work for PeakRC and we have a contract but I don't have the time to look up our account info.

I am using Telerik controls in a new MVC app that we are writing.

I have tried many variations and now I have very simple view:
@using (Html.BeginForm("_CreateMessage", "Message", FormMethod.Post, new { id = "_CreateMessage" }))
{
<fieldset>
<div class="editor-field">
@(Html.Kendo().EditorFor(item => item.Body).Encode(false))
@Html.ValidationMessageFor(item => item.Body)
</div>
</fieldset>
}

and model:
[DataType(DataType.Html)]
[AllowHtml]
public string Body{ get; set; }

the editor displays but is read only.

Help,

kwilson@peakrc.com

4 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 07 May 2014, 07:37 AM
Hi Kory,

I tried to reproduce the issue, but everything works as expected on our side. Could you please check this screencast and let me know if I am doing something differently?

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
CIQIntegration
Top achievements
Rank 1
answered on 11 Jan 2016, 04:05 PM

Hi,

 

i try to get excact that behaviour which Kory dont wants to :)

how can i (in Razor) make an EditFor readonly?

in fact i didnt found any examples in razor about that topic.

 

thanks & kind regards

Mike

0
Alexander Popov
Telerik team
answered on 13 Jan 2016, 10:30 AM
Hi Mike,

The best approach is to get the widget's instance after initialization, then remove the contenteditable property, as described in the documentation.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
CIQIntegration
Top achievements
Rank 1
answered on 13 Jan 2016, 10:34 AM

Hi Alexander,

 

thanks for your reply.

what a pity that it's all done via JS and no Dependency properties in Razor.

i decided now to use a DisplayFor to show the value as not editable.

 

regards

Mike

Asked by
Kory
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
CIQIntegration
Top achievements
Rank 1
Share this question
or