vineel
vineel

Reputation: 3683

Kendo UI MVC: Add widgets on demand ( dynamically )

I am using Kendo UI MVC wrappers in our ASP.net MVC application. In the user creation view, depending on the value of Numeric box(Number of Children) I need to dynamically show the widgets for child name and child age.
How can we achieve this using Kenod UI MVC? Can someone share the URL of demo implementing the above scenario?

Upvotes: 0

Views: 357

Answers (1)

DontVoteMeDown
DontVoteMeDown

Reputation: 21465

You have to generate the form elements. You can generate the html and append to a div container and set the data-role for all kendo widgets, then call kendo.init() in that container, e.g:

// Do this inside a loop by the Number of Children set in the other form element
$("#container").append("<input type='numeric' data-role='numerictextbox' name='child_age[]' />");
kendo.init("#container");

Working demo

Upvotes: 2

Related Questions