2

Hi all I did search to see for answer but nothing.

My question is related to dotvvm framework. I have installed dotvvm into a existing mvc 5 application and work correctly but becouse the dotvvm does not know razor markup I can't use telerik ui for mvc. Have somebody found a solution to this problem ?

Your wolkaround or council is appreciated.

Thanks

Gioking
  • 21
  • 3
  • 2
    You don't have to use the server wrappers (razor syntax). JQuery or declarative syntax can work just as well in an MVC5 application. – NigelK Apr 07 '17 at 23:02

1 Answers1

3

Telerik MVC controls cannot be used in DotVVM pages right now, we are thinking about MVC interop, but it's not in the framework yet.

But the MVC controls are wrappers for Telerik Kendo UI which can be used without ASP.NET MVC.

There a nice Knockout Kendo library which allows to use the Kendo UI controls with Knockout JS. Since DotVVM is based on Knockout JS, you can use the data-bind syntax in your DOTHTML pages and access the viewmodel properties:

<input data-bind="kendoNumericTextBox: Price" />

The viewmodel looks like this:

public class MyPageViewModel { public decimal Price { get; set; } }

There will certainly be some limitations and unfortunately there are no DotVVM wrappers for Kendo UI, but the basic controls can work like this.

If you have more complex scenarios (DataGrid control or something like this), you can use the plain JavaScript solution and access the viewmodel properties using the following JavaScript syntax:

dotvvm.viewModels.root.viewModel.Price()

But the viewmodel is not a plain JS object, it is wrapped with Knockout observables, so you have to unwrap everything, or use dotvvm.serialization.serialize to build plain JS objects.

Tomáš Herceg
  • 1,595
  • 1
  • 13
  • 18
  • Thanks for your answer – Gioking Apr 10 '17 at 07:42
  • Ability to use Telerik Controls with dotvvm would be incredibly helpful... But I can see how this is not a priority... – Nelson Jul 19 '17 at 09:57
  • Im liking dotVVM so far (haven't begun yet but looks very cool) . this post as helpful to me, as was this link https://www.dotvvm.com/docs/tutorials/control-development-interactivity/2-0 . It appears you can use Knockout itself to get and set viewmodel – Tim Davis Apr 27 '18 at 03:29
  • Yes, and there is a library called Knockout-Kendo which allows using Telerik Kendo UI in Knockout JS apps. – Tomáš Herceg Apr 27 '18 at 12:04