Click here to Skip to main content
15,499,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
The ultimate goal here is to build a dynamic, user editable dashboard in my system, more or less like the one in the Azure portal.

At present all my dashboard widgets are already self contained ViewComponents, they make Ajax calls to get their own data, but the layout of that dashboard is rigidly defined in a razor page.

The actual display of the dashboard isn't an issue, should be a simple db call to check which widgets to display and where on the page to place them, then I can just iterate over that dataset in the razor page.

My "problem" is on the "edit dashboard" screen.

I need a panel with "available widgets", which Id probably populate on the GET request and get the list of widgets using reflection (they're all inheriting from a common base class)

The idea is the user will drag from a list of of available widgets, and drop it on the dashboard. I'd imagine that onDrop id have to make an ajax call to a controller that will "render" the razor code to html (and its accompanying js) then the js can inject that text/html into the dom?

So the actual question is then, how in the controller can I get the html that a razor ViewComponent will generate if I had dumped it on a razor page?

Or alternatively, a different approach that could achieve the same idea?

Thanks for reading my wall of text.

H

What I have tried:

I have the "grid" and dragging, dropping and resizing of placeholder div's working.

Right now I'm researching the topic
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900