Telerik Kendo MVC TextBox Multiline Mode
Asked Answered
C

3

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.

Cuttler answered 20/1, 2016 at 16:12 Comment(0)
F
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.

Fanatical answered 20/1, 2016 at 17:46 Comment(3)
Thanks! Do you also know how to remove the resize option?Cuttler
If u use html.textArea then its not a Kendo control any more and just styling over it as kendo control is not acceptableSargasso
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.Bravin
W
1

If you want to use with a model:

@Html.TextAreaFor(x => x.Description, new { @class = "k-textbox", style = "width: 100%;", placeholder = "Notes... Descriptions..." })
Walkthrough answered 17/6, 2020 at 8:31 Comment(0)
S
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)

Sheilasheilah answered 12/9, 2022 at 15:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.