简体   繁体   English

我们可以使用HttpHandler和HttpModule从母版页更改内容页div吗?

[英]Can we use HttpHandler and HttpModule to change the content page div from the Master page?

In my application i create a navigation menu dynamically. 在我的应用程序中,我动态创建一个导航菜单。 When I click on the anchor tags that refer to various content page I want to capture the anchor tags' text and display it in a div in the content page. 当我单击引用各个内容页面的锚标记时,我想捕获锚标记的文本并将其显示在内容页面的div中。

How can i possibly achieve this? 我怎样才能做到这一点?

Can it be done through HttpHandlers? 可以通过HttpHandlers完成吗? or do I need to look into something else??? 还是我需要研究其他东西??? Please help. 请帮忙。

Assuming that you want your div to look different or be positioned in different places for each content page and all you want to display in that div is the page URL you can solve this using a simple script that you can add in your master page: 假设您希望每个内容页面的div看起来不同或位于不同的位置,并且要显示在该div中的全部是页面URL,则可以使用可以添加到母版页中的简单脚本来解决此问题:

document.onload = function()
{
    var titleDiv = document.getElementById("titleDiv");
    titleDiv.innerText = window.url;
}

The only constraint is that your div must have the same id in all the content pages. 唯一的限制是您的div在所有内容页面中必须具有相同的ID。

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

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