Lawn Dork
2020-08-06T15:22:19Z
I've been trying to integrate YAF into my MVC solution, and I'm coming across problems. I'm not sure it's possible. I don't know enough about Web Forms / YAF to know if this fact about MVC will make YAF not work. Apparently server controls are not available in MVC, along with some other differences.

Quote:

ASP.NET MVC doesn’t support server controls, only option available is using html input controls. In MVC, detailed knowledge of HTML, JavaScript and CSS is required. If you want to develop anything rapidly, choose ASP.NET Web Forms.


https://forums.asp.net/t/2090133.aspx?How+do+I+add+Web+Forms+support+to+an+MVC+project+ 

Quote:

Because most of them depend on things like ViewState and the Postback models which are part of the classic WebForms model and no longer exist in ASP.NET MVC. Those server side controls rely on events that will perform postbacks to the server persisting their state in hidden fields (ViewState). In ASP.NET MVC you no longer work with events such as Button1_Click. In ASP.NET MVC you work with a Model, a Controller and View. The Controller is responsible for receiving user requests, querying the Model, translating the results into a view model and passing this view model to the View whose responsibility is to display it under some form.

In ASP.NET MVC there are HTML helpers that could be used to generate some reusable HTML fragments between views. You may take a look for example at the Telerik ASP.NET MVC suite of such helpers. They call them controls but they have nothing to do with classic WebForms server side controls. They are just HTML helpers.

Basically classic WebForms are a leaky abstraction of the web. What Microsoft did back in the time when they designed this framework was to bring existing Windows developer skills to the web which was getting more and more momentum. But since the web was still a new technology that most developers weren't yet familiar with, they created this abstraction to hide away the way that the www works. Those developers were accustomed to drag and dropping controls on their Windows Forms, double clicking on buttons that was generating some code for them in which they put their data access logic and so on. This model was transposed to web application development thanks to WebForms. The HTTP protocol was successfully hidden behind this abstraction called WebForms. For example you don't need to know HTML, nor Javascript, not even CSS in order to create a website using WebForms which is really great because the framework abstracts all those things for you. Unfortunately by doing so it prevents you from easily utilizing the full power of lower level web technologies which some people might need when developing web applications.

What ASP.NET MVC does is basically remove this leaky abstraction and bring the www to the developers the way it was intended to be by its creators. ASP.NET MVC is not mature enough compared to classic WebForms so you cannot expect to find the same range of available controls and widgets but things are slowly shifting.

I would recommend you start here with ASP.NET MVC: http://asp.net/mvc . Go ahead, watch the videos, play around with the samples and see if ASP.NET MVC is for you or not. And of course if you encounter some specific difficulty or question don't hesitate to come back here and ask it.


https://stackoverflow.com/questions/9039019/why-cant-i-use-server-controls-in-asp-net-mvc 

Do these differences make it impossible for YAF to run in a MVC solution?
Sponsor
tha_watcha
2020-08-09T12:19:44Z
i Updated the YAF SampleApplication  it now included MVC samples to show how to mix webforms and MVC Views together.
UserPostedImage

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved