ASP .NET Menu Navegation problem (One Aspx per page, frames etc )
Today I have a Masterpage that contains my menu... Each aspx use that masterpage... Everytime I click in an item menu, a new aspx is loaded... Works fine...
But now I´d like to maintain the menu always on screen (Iframe?) and only change the content...
How Is the best way to achieve that?
开发者_如何学PythonI´m usign Web Form, ASP .NET 4.0.
Thanks
There are two main ways that spring to mind:
- Put your content in an iframe
- Use AJAX or something similar to dynamically change the content, rather than posting back each time.
Both of these have drawbacks, and if I were you, I'd seriously consider whether you really need to alter the navigation of your website in such a fundamental way. If you just want some controls in your master page to maintain their state between clicks, there are other ways you can manage that.
In both cases, bear in mind that if you want users to be able to share or bookmark direct URIs to the content you're offering, you will have to program a way for them to do that. You may also affect how search engines rank and index your pages.
An AJAX solution will give you more flexibility and probably look nicer, but you will have (for example) issues with the Back button. The iframe idea could lead to odd behavior on the client end (such as content scrolling independently from the rest of the page) and many browsers' XSS security features will prevent you from using any JavaScript across the frame boundaries.
Overall, I'd say the AJAX method is probably better than iframes for most situations, but if you can get away with the standard click-through page navigation, I'd use that instead.
精彩评论