Net菜单中的StaticItem模板

Net菜单中的StaticItem模板

本文介绍了ASP.Net菜单中的StaticItem模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要帮助....

目前,我试图在ASP.Net的主页中采用免费的CSS模板.我被困在菜单区.假设情况是这样的.

1.来自HTML的当前菜单将被ASP:Menu替换为:

Need help please....

Currently i trying to adopt a free CSS template into a masterpage in ASP.Net. I got stuck at the menu area. Let say the scenario is like this.

1. Current menu from HTML that will be replace by ASP:Menu is :

<ul>
     <li><a href="index.html"><span><span>Home</span></span></a></li>
     <li><a href="support.html"><span><span>Home</span></span><a></a></a></li>
     ...
</ul>



2. CSS的目标是跨度,因此在CSS中使用这些选择器将菜单图片的左图和右图放在了菜单中:



2. The CSS was targeted to the span so it put left pic and right pic for menu pic with these selectors in CSS:

ul li a { background:url(images/menu_left.gif) no-repeat left top; }
ul li a span { background: url(/images/menu_right.gif) no-repeat right top;}



3.现在,我尝试将菜单从HTML移至masterpage.master,并使用Web.sitemap将其替换为



3. Now i try to move that menu from HTML to masterpage.master and replacing it with

<asp:Menu>

.但是我遇到了CSS的问题.因此,我想尝试使用

using Web.sitemap. But i got the problem with the css. therefore i want to try to use the

<staticitemtemplate></staticitemtemplate>

.但是我找不到路.我尝试将其放在masterpage.master中,如下所示:

. But i can''t find the way. I try to put it in masterpage.master like this:

<staticitemtemplate>
  <ul><li><a href=""><span><span></span></span></a></li></ul>
</staticitemtemplate>


当我将其放在浏览器中并去查看页面源代码时,它将成为它们在asp:menu的预生成代码中的模板.


when i put it in browser and go to view the page source it become them template inside the pregenerated code of asp:menu.

<ul class="level1">
  <li><a title="Home" class="level1 selected" href="default.aspx">
    <ul><li><a href=""><span><span></span></span></a></li></ul>
  </a></li>
</ul>



那是故事.有人可以在这件事上帮助我吗?
如何为菜单安排合适的项目模板?


谢谢.



That is the story. can somebody help me in this matter ?
How to arrange a proper item template for menu ?


Thank you.

推荐答案

<staticitemtemplate>
    <span><span><![CDATA[<%# Eval("Text") %>]]> </span></span>
</staticitemtemplate>



通过这种方式,我得到了CSS生效所需的html结构.但是我要问另一个问题.这个问题问了我足够长的时间,但不知道怎么问.

我如何知道Eval拥有什么财产?与Bind一样吗?

谢谢.



by that i got the html structur i need for CSS to take effect. but i come to another question. this question come to me quite long enough but don''t know how to ask.

How do i know what property Eval over ? is it the same with Bind ?

thank you.


这篇关于ASP.Net菜单中的StaticItem模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 13:33