这个asp.net页面中的title如何获取页面中产品名称?

来源:百度知道 编辑:UC知道 时间:2024/05/09 05:09:48
<%@ page title="这里是需要获取的产品名称- 产品展厅 - **有限公司" language="C#" masterpagefile="~/cn/MasterPage.master" autoeventwireup="true" inherits="cn_Product_Detail, DHB.cn" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="pro_right_neiye">
<asp:Repeater ID="re1" runat="server"><ItemTemplate>
<div class="pro_name">
<span class="pro_name_word"><%#Eval("title") %>(补充:这里是要获取的产品名称)</span>
<div class="float border_1"></div>
<div class="float border_2"></div>
<div class="clear"></div>
</div>

我不太明白你把Title 放到 page 里面有什么用.
如果是需要显示为页面标题.
是需要放到<head><title></title><head> 的 title 结点中的.
使用JS或CS都可以实现.
这里用JS举例.

<span onclick="doclick(this)" class="pro_name_word"><%#Eval("title") %>(给span加一个onclick事件.)</span>

<script language="javascript">

function doclick(obj)
{
document.title = obj.innerText;
}
</script>

可以用正则表达式 或 普通的字符串处理
提取
<span class="pro_name_word">

</span>

之间的部分

你可以写在后台了。。。
直接写在Page_Load里面
Page.Title="这里是需要获取的产品名称- 产品展厅 - **有限公司"......

用了母版的子页面我都是这么做的。 不懂再问我吧。。