开发者

How do I merge aspx pages MVC?

I want to merge a sidemenu.开发者_JAVA百科aspx on another (Home.aspx, Phone.aspx, Car.aspx... etc) page. How do I do that?


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.


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!


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.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜