13

Does anyone know what properties to set to make a Kendo MVC Textbox Multiline?

 @(Html.Kendo().TextBox()
     .Name("txtComments")
     .Value(@Model.Comments)
     .HtmlAttributes(new { style = "width:100%" })
 )

Thanks.

Cef
  • 661
  • 1
  • 6
  • 26

3 Answers3

25

If you want a textarea, I'd recommend doing it this way:

@Html.TextArea("textarea", "", new { @class="k-textbox", style = "width: 100%;" })

as their demo shows. This will allow you to get the same Kendo styling, if that's what you're going for.

Matt Millican
  • 4,044
  • 4
  • 38
  • 55
  • Thanks! Do you also know how to remove the resize option? – Cef Jan 20 '16 at 20:00
  • 2
    If u use html.textArea then its not a Kendo control any more and just styling over it as kendo control is not acceptable – mongesh madhavan Dec 28 '17 at 12:26
  • 1
    how is it not acceptable? Kendo gave us access to the class for a reason, and that's how their own demo shows to do it. Additionally if you view the generated javascript, most of their controls translate into bootstrap with classes on them anyway. – John Lord Mar 20 '19 at 03:23
1

If you want to use with a model:

@Html.TextAreaFor(x => x.Description, new { @class = "k-textbox", style = "width: 100%;", placeholder = "Notes... Descriptions..." })
suleymanduzgun
  • 365
  • 8
  • 17
0

My guess is that this is what you're looking for:

@Html.Kendo().TextArea()

Rather than:

@Html.Kendo().TextBox()

I found this question after wondering why TextBox didn't have a "Multiline" property or something similar... Turns out I was using the inappropriate object.

https://demos.telerik.com/aspnet-mvc/textarea

(Note that TextArea() may have not been available when the question was created)

NightShovel
  • 3,032
  • 1
  • 31
  • 35