Create a custom Dashboard with .Net instead of Angular
Is it possible to create a dashboard page that uses a .Net Controller rather than AngularJS?
I need to display data from a database table and update the data as well.
I have seen the video by jondjones Create A Custom Backend Dashboard in Umbraco V9 but I'm not sure if it still apples to V10 or if it is the best way to do it. Unfortunately I haven't found any other info yet.
I haven't watched that video, but most things in v9 should still apply in v10. As far as I know, though, you can't directly use a .NET controller and view as a dashboard, because Umbraco is expecting an Angular component. I suppose you could create a controller and view, set up a normal Angular dashboard, and embed the custom .NET page in an iframe, but you'd have to implement your own mechanism for access protection, and you'd have to work around the other iframe quirks. I wouldn't recommend it.
What I have done is create a .NET API controller that handles as much of the logic as possible, and write basic code in Angular to handle just the input and HTML rendering parts. For example, provide the table data in JSON from the API controller, and just use Angular to parse it into HTML. Provide an API endpoint to update the table, and just use Angular to send the updated data. This is what has worked best for me.
If you want to push that idea even further, you could technically have the API controller send HTML for Angular to output directly in an "unsafe" way, but that has its own pitfalls.
Create a custom Dashboard with .Net instead of Angular
Is it possible to create a dashboard page that uses a .Net Controller rather than AngularJS?
I need to display data from a database table and update the data as well.
I have seen the video by jondjones Create A Custom Backend Dashboard in Umbraco V9 but I'm not sure if it still apples to V10 or if it is the best way to do it. Unfortunately I haven't found any other info yet.
I haven't watched that video, but most things in v9 should still apply in v10. As far as I know, though, you can't directly use a .NET controller and view as a dashboard, because Umbraco is expecting an Angular component. I suppose you could create a controller and view, set up a normal Angular dashboard, and embed the custom .NET page in an iframe, but you'd have to implement your own mechanism for access protection, and you'd have to work around the other iframe quirks. I wouldn't recommend it.
What I have done is create a .NET API controller that handles as much of the logic as possible, and write basic code in Angular to handle just the input and HTML rendering parts. For example, provide the table data in JSON from the API controller, and just use Angular to parse it into HTML. Provide an API endpoint to update the table, and just use Angular to send the updated data. This is what has worked best for me.
If you want to push that idea even further, you could technically have the API controller send HTML for Angular to output directly in an "unsafe" way, but that has its own pitfalls.
Thanks for your reply. That is what I have had to do, I tried doing it fully with a controller but just could not get it to work.
As you said, I have the minimum AngularJs code with the main code in an API controller. So far, it seems to be working OK.
is working on a reply...