简体   繁体   English

如何在回发时加载带有冻结标题的页面内容?

[英]How can I load page content with freeze header on postback?

I'm using asp.net and c#.net. 我正在使用asp.net和c#.net。 I'm gonna implement a website that has content navigation like that Microsoft did on this link: Microsoft Windows 我要建立一个网站,该网站的内容导航类似于Microsoft在此链接上所做的: Microsoft Windows

In this link you're able to browse page content with freeze header on postback and also you're able to browse videos from left Navbar without page postback. 在此链接中,您可以浏览带有回发时冻结标题的页面内容,还可以浏览左侧导航栏中的视频而无需页面回发。 The important thing is for each click url is changed. 重要的是每次单击的URL都会更改。

Any ideas or help would be appreciated. 任何想法或帮助,将不胜感激。

Thanks and regards 谢谢并恭祝安康

First off, to clarify, postbacks are only required if you're submitting form elements. 首先要澄清的是,只有在提交表单元素时才需要回发。 If you're creating a webforms application, you can easily use controls like HyperLink with a NavigationUrl to navigate among URLs without needing postbacks. 如果要创建Webforms应用程序,则可以轻松地将HyperLink控件与NavigationUrl一起使用,从而在URL之间进行导航而无需回发。

If what you mean is that you're seeing the page partially updating when following links, that's not what I'm experiencing. 如果您的意思是跟随链接时页面正在部分更新,那不是我所经历的。 The pages appear to completely reload when the links in that page are clicked. 单击页面中的链接后,页面似乎完全重新加载。 In your own site, you can use AJAX and JavaScript to implement a navigation system that doesn't require heavy navigation requests. 在您自己的站点中,您可以使用AJAX和JavaScript来实现不需要繁重导航请求的导航系统。 Look at Manipulating the browser history (MDN) for information on exciting new JavaScript features that will let you modify the browser's URL/history without reloading the page. 参阅“操纵浏览器历史记录(MDN)”,以获取有关令人兴奋的JavaScript新功能的信息,这些新功能将使您无需重新加载页面即可修改浏览器的URL /历史记录。 There are several JS libraries that integrate with this feature to give you "AJAX" navigation capabilities. 有几个与该功能集成的JS库为您提供“ AJAX”导航功能。

To simply get the header to not scroll along with the rest of the page, use position: fixed in the CSS for the element. 为了简单地使标题不随页面的其余部分一起滚动,请使用position: fixed在CSS中position: fixed的元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM