JuergenGutsch / blog

Personal blog about web development based on .NET and .NET Core
https://asp.net-hacker.rocks/
Other
31 stars 17 forks source link

View Components in ASP.NET 5 #20

Open JuergenGutsch opened 5 years ago

JuergenGutsch commented 5 years ago

Written on 30.11.2015 08:02:41

URL: http://asp.net-hacker.rocks/2015/11/25/viewcomponents-aspnet5.html

JuergenGutsch commented 5 years ago

Comment written by Vishal Thaker on 23.03.2018 14:31:45

How do you handle events within viewcomponent? In my case if I have a dropdown and I need to have a on change event or a button click event to do something...how do I do it?

JuergenGutsch commented 5 years ago

Comment written by Jürgen Gutsch on 27.03.2018 07:19:15

Hi,
In ASP.NET MVC there are now such things like events in the page life-cycle.
If you interact with form elements you usually do an form post and react in the post action on the passed values.
This is the common ASP.NET MVC way, independent from .NET Core or .NET Framework and independent from ViewComponents or regular Views:
https://docs.microsoft.com/...

SlyFamily commented 5 years ago

i cant use view component in my mvc project. error: the namespace name "viewcomonent" not found

JuergenGutsch commented 5 years ago

I think I need some more information to help you. Currently It looks like a typo: Should be ViewComponent instead of viewcomonent