Multiple EditorFor

2 posts, 0 answers
  1. Janko
    Janko avatar
    5 posts
    Member since:
    Sep 2010

    Posted 28 May 2014 Link to this post

    Hi,

    i have problems with multiple editors on the same page:

    01.@model IEnumerable<SampleViewModel>
    02. [...]
    03.@foreach (var item in Model)
    04.{
    05. <div class="form-horizontal">
    06.        <div class="form-group">
    07.            @Html.LabelFor(modelItem => item.Html, new { @class = "control-label col-md-2" })
    08.            <div class="col-md-10">
    09.                @Html.Kendo().EditorFor(modelItem => item.Html).Tools(tools=>tools.ViewHtml()).Encode(false)
    10.            </div>
    11.        </div>
    12.    </div>
    13.} [...]

    I know that each editor needs a unique name, but than a post to the controller with the correct model doesn't work... what is the best practice here?
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 29 May 2014 Link to this post

    Hello Janko,

    You can use the HtmlAttributes fluent API to set the editor id attribute without affecting the textarea name attribute.

    Regards,
    Alex Gyoshev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top