9 Answers, 1 is accepted
I am happy to inform you that we introduced such an Html helper in our UI for ASP.NET MVC suite starting Q2 2014 (v.2014.2.716). You can use it in the following way:
//Razor syntax
@(Html.Kendo().TextBox()
.Name("kTextBox")
.Value("Test")
)
Best regards,
Sebastian
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.
Can you double-check that you updated the assembly references in your project to reference the 2014.2.716 version in it? I tested this simple example again and it work as expected, using the VS Extensions New Project wizard for web application boilerplate.
Regards,
Sebastian
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.
To be clear:
@(Html.Kendo().TextBox()
.Name("kTextBox")
.Value("Test")
.Events(....) <--- does not exist
)
The TextBox helper was introduced for unifying the styles of the simple input element with other helpers from the UI for ASP.NET MVC suite. If you need to handle some events of the input element you could attach the handlers through the HtmlAttributes or with jQuery after the rendering of the element.
Regards,
Konstantin Dikov
Telerik by Progress
I know this is an old thread but I ran into the same limitation with Events not working for the TextBox helper. In my case I was trying to "unify the styles of the simple input element with other helpers" as you say so had code like this:
@(Html.Kendo().DateTimePicker()
.Name("myDateTimePicker")
.Events(e =>
{
e.Change("onChangeMyDateTimePicker");
})
)
@(Html.Kendo().TextBox()
.Name("myTextBox")
.Events(e =>
{
e.Change("onChangeMyTextBox"); // this fails
})
)
function onChangeMyDateTimePicker() {
let newDateTime = this.value();
// do something with it
}
and of course the second part failed, so I had to do it as you suggested like this:
$(document).ready(function () {
$("#myTextBox").change(onChangeMyTextBox);
});
function onChangeMyTextBox() {
let newText = $("#myTextBox").val();
// do something with it
}
OK, fine, it works, but it doesn't feel very unified.
The TextBox helper does not expose built-in events, but if you thing that this will be a good addition to the suite, you could create a feature request in our feedback portal:
Best Regards,
Konstantin Dikov
Progress Telerik