Registering Widgets

lawrence whittemore asked on June 4, 2021 16:05

I see two types of ways to register widgets. Why would we chose one over the other? is the first for ones with specific view Components? here are two ways I have them. One is a widget I am working on for creating sliders (Based it off of the articles widget in dancing goat), the other is just the example from the documentation.

[assembly: RegisterWidget(SlidersWidgetViewComponent.IDENTIFIER, typeof(SlidersWidgetViewComponent), "Slider", typeof(SlidersWidgetProperties), Description = "Displays slides based on path.", IconClass = "icon-l-list-article", AllowCache = true)]

[assembly: RegisterWidget("Intranet2021.Widgets.NumberWidget", "Selected number",  typeof(NumberWidgetProperties), customViewName: "~/Components/Widgets/Number/_NumberWidget.cshtml", IconClass = "icon-octothorpe")]

Recent Answers

Dmitry Bastron answered on June 4, 2021 18:51

Hi Lawrence,

As far as I can tell, the first one is used in .NET Core MVC (refer to docs), and the second one - in .NET MVC5 (refer to docs).

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.