Changing the Kendo UI upload widget's text

I would like to change the default text of Select to something more appropriate for the context. I'm using the Kendo Fluent API built on the HtmlHelper class and I didn't find a way to change the text neither in the basic functions nor in the localization.

My code is pretty simple and looks like this:

@(Html.Kendo().Upload()
      .Name("FilesToUpload")
)

There is a suggestion in this thread about a jQuery function to change the text, which works perfectly if I use the javascript API of the Upload widget but doesn't work when I create the widget via Html.Kendo().Upload.

And even better with the javascript API there is a:

localization: {
    select: 'any text'
}

Settings you can use, but this doesn't help me either.

If anyone has faced this problem before and tackled it I would really appreciate his help.

Upvotes: 13

Views: 12358

Answers (3)

James Gray
James Gray

Reputation: 594

For AngularJS usages this is an example of using the localization, note the k-localization attribute:

<input name="Images" type="file" kendo-upload
        k-multiple="true"
        k-upload="inventoryProductDetail.uploadImage"
        k-success="inventoryProductDetail.uploadedImage"
        k-async="{ saveUrl: '/API/UploadFile/.json', autoUpload: true }"
        k-localization="{ select: 'SELECT ME!' }" />

Upvotes: 3

I have just received an answer on the kendo forums in this thread. And the solution is pretty easy, but the feature was just a little hidden in the fluent interface:

@(Html.Kendo().Upload()
      .Name("FilesToUpload")
      .Messages( m => m.Select("Select unit bulk upload file"))
)

Upvotes: 20

Trey Gramann
Trey Gramann

Reputation: 2004

Unfortunatly you do have to follow the suggestions on that post. Here is how to do it in your situation.

@(Html.Kendo().Upload()
      .Name("FilesToUpload")
)
<script type="text/javascript">
    $(document).ready(function () {
        $("#FilesToUpload").closest(".k-upload").find("span").text("my text");
    });
</script>

I try not to think that the Kendo controls are going to get me to 100%, because then I would be disappointed. Instead assume they will get you 90% of where you want to go quickly. Then use jQuery and some detective work to perfect.

Upvotes: -1

Related Questions