Search code examples
c#asp.netblazorweb-parts

ASP.NET 2.0 Web Parts migration to Blazor


I'm planning to migrate a legacy ASP.NET Web Parts application to Blazor (most likely server-side).

I know that ASP.NET Web Parts won't be migrated to .NET 6 so I'm wondering if Blazor can offer something that can replace them. I need the end-user to be able to add controls to the page so every user can get tailored UI. The communication mechanism between the web parts was very important in the legacy application - for example a text box in one web part was used as filtering criteria for grid in another web part.

If Blazor can not provide replacement for ASP.NET Web Parts can you suggest something from React/Angular.


Solution

  • It's been a very long time since I looked at Web Parts, so I may be missing some features, but you can add and remove components dynamically in Blazor. That way, your users can set up their layout, and you can store the info, ready for re-creation next time they load the page.

    As for communication between components, that's also pretty easy, as Blazor has SignalR built in. You can add a message broker to your app, and use that to pass messages around, much like MVVM messaging of you're familiar with that.

    I'm not in front of my PC right now, so can't post much code, but if you look at this blog post I wrote a while back, you'll see how easy it is to do.

    Hope that helps.