Tutorial :How do I merge aspx pages MVC?



Question:

I want to merge a sidemenu.aspx on another (Home.aspx, Phone.aspx, Car.aspx... etc) page. How do I do that?


Solution:1

You're a little vague, but I believe you're looking for Master pages, and ContentPlaceHolder controls. The default website when creating a ASP.NET MVC application is set up with some default ones.


Solution:2

In MVC, You can embed a page into another with a function in the "mvc futures" libraries

In your general page you would have:

<% Html.RenderAction("Index", "SideMenu"); %>  

Which will call the action "Index" of the controller "SideMenu" that would return the view "sidemenu.aspx"

This could be added to the master page Agent_9191 is talking about!


Solution:3

While you probably should have a Master Page that can contain your sidebar (this is how I do things), you could also have sidebar as a View User Control, which can be rendered using the Html.RenderPartial helper method.


Solution:4

I had to merge webforms pages with an asp.net mvc page a few months ago. The most seamless and easiest way I found to do it was using an iFrame:

<iframe src="/path/to/file.aspx" frameborder="0" width="970" height="970">  </iframe>  

It looks like its just part of the site, and the aspx postbacks/viewstate worked perfect with no other changes to asp.net required!


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »