How can i bind the text of a button - or anchor - to a viewmodel?

4 posts, 0 answers
  1. Peter
    Peter avatar
    4 posts
    Member since:
    Aug 2013

    Posted 28 Aug 2013 Link to this post

    To dynamically change the language of my application i' trying to use databinding to a viewmodel. It works great on labels and simple texts, but when i bind a button with e.g.

    <a data-role="button" data-bind="text: i18n.connect" data-click="app.connectClicked">TEST</a>

    I get an error message:
    The text binding is not supported by the Button widget

    Is there a workaround for this?


  2. Kiril Nikolov
    Kiril Nikolov avatar
    2596 posts

    Posted 29 Aug 2013 Link to this post

    Hello Peter,

    Such binding is not supported out of the box with Kendo UI. However using a custom binder you can achieve such functionality. Please check this example of a possible implementation:

    If you want to read more about custom binding, please follow this link:

    Kiril Nikolov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Henri
    Henri avatar
    88 posts
    Member since:
    Aug 2008

    Posted 04 May 2017 Link to this post

    This is an old question, but I've solved this by binding an inner <span> element instead of the <a> directly

    <a data-role="button"><span data-bind="text: blabla"></span></a>

    Does not seem necessary to make a "custom binder", correct?



  4. Ivan Zhekov
    Ivan Zhekov avatar
    651 posts

    Posted 08 May 2017 Link to this post


    you are still binding the text, but not to a viewmodel i.e. you can't dynamically change the text after you've set it.

    Still, if this way of binding works for you, then you don't need the custom binder.

    Ivan Zhekov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top