I have a large web application that I have set up as both ASP.Net Web Forms and MVC. Some of the newer pages are MVC (.mvc) and some are Web Forms (.aspx). Since this is a business app and functions are being constantly added, it's hard for me to have the time to stop and replace existing functionality to convert it over. So I would like to do it piece by piece, control by control.
To do this, all I would need to be able to do is to replace certain controls with
<% Html.RenderPartial() %>
or <% Html.HelperMethod %>
Is it possible to include namespaces or inherit the page from something to allow these methods to be used, while still maintaining the rest of the Page life cycle for other controls on the page?
Answers. You don't need to add a special route to add a webforms . aspx page to your MVC applications. Just add the file and it will work as long as you don't put it in the Views folder.
Luckily, the answer is yes. Combining ASP.NET Webforms and ASP.NET MVC in one application is possible—in fact, it is quite easy. The reason for this is that the ASP.NET MVC framework has been built on top of ASP.NET. There's actually only one crucial difference: ASP.NET lives in System.
Partial function which renders the Partial View. The name of the View and the object of the CustomerModel class are passed to the @Html. Partial function. In order to add Partial View, you will need to Right Click inside the Controller class and click on the Add View option in order to create a View for the Controller.
I saw this question and I remembered that I've read a few posts by Scott Hanselman regarding this, so here you go:
Also two more articles on the subject:
I think to summarize you can:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With