Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to put a middleware between rendering partial view? #2267

Open
NguyeNgocPhus opened this issue Jun 2, 2023 · 1 comment
Open

Comments

@NguyeNgocPhus
Copy link

image
I want to put a middleware before rendering this partial view. is this possible?

@muratcakir muratcakir changed the title is it possible to put a middleware between rendering partial view? Is it possible to put a middleware between rendering partial view? Jun 2, 2023
@muratcakir
Copy link
Contributor

What do you mean by middleware? I assume you mean some HTML snippet, another partial or view component, right? If so, you need to declare a widget zone where you can inject content into:

<zone name="my_zone_name" />

You can inject content by using IWidgetProvider from anywhere you like (it is a scoped dependency):

_widgetProvider.RegisterWidget("my_zone_name", new ComponentWidget(...));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants