EditorFor is read only

5 posts, 0 answers
  1. Kory
    Kory avatar
    2 posts
    Member since:
    Dec 2010

    Posted 05 May 2014 Link to this post


    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
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 07 May 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. CIQIntegration
    CIQIntegration avatar
    3 posts
    Member since:
    Jul 2015

    Posted 11 Jan Link to this post

    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

  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 13 Jan Link to this post

    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!
     
  6. CIQIntegration
    CIQIntegration avatar
    3 posts
    Member since:
    Jul 2015

    Posted 13 Jan in reply to Alexander Popov Link to this post

    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

Back to Top
Kendo UI is VS 2017 Ready