Last post Sep 15, 2016 02:18 AM by Wenushka
Sep 13, 2016 03:03 AM|asp.net9984|LINK
I am loading a Partial View through JQuery Dialog.
If I place the Knockout binding inside the Partial View, it works properly, however it'll try to bind again when the Dialog gets opened 2nd time.
I think it's a good practice to leave the Binding in the parent view. but it doesn't appear to reference the DOM objects properly. What do you guys do in thise instance?
Sep 15, 2016 02:18 AM|Wenushka|LINK
First knockout ko.applyBindings can only be called only once for a given element.
Probably you are applying kncockout binding, when opening the dialog or
when each time the dialog (partial view) is fully loaded.
If the partial view is rendered only once and use it to show the dialog, then apply the binding once in the parent when the dom is fully loaded.
If you want to do some changes in to the properties, you can update the properties of view model (like reset property values) before opening the dialog.
Thanks & Regards,