未排序列表中的列表项无法正常工作 [英] List item in un ordered list not working properly
问题描述
大家好,
创建菜单使用html Un ordered list,
使用Href:1列表项重定向到A文件夹中的一个Web表单。
第二个列表项重定向到B文件夹中的另一个Web表单。
对于第一个完美导航的列表项,
但是当点击第二个列表项时,它正在从A文件夹中搜索文件,而不是搜索在B文件夹,
请建议我解决这个问题,
提前致谢。
我的尝试:
Hi All,
Created Menu using html Un ordered list,
Using Href : one list item redirecting to one web form in A folder.
Second list item redirecting to another web form in B folder.
For the first list item navigating perfectly,
but when clicking on the second list item , it is searching for the file from A Folder, Rather searching in B Folder,
Please suggest me in solving this,
Thanks in advance.
What I have tried:
推荐答案
你'指定相对URL。这将与当前页面相关。如果您位于网站的根目录中,则两个链接都是正确的。但如果您在A
文件夹中的某个页面上,则这两个链接都是错误的,因为它们将解析为/ A / A / Webform1 .aspx
和/A/B/Webform2.aspx
。
添加runat =server
到< a>
标签,并使用app相对路径:
You're specifying a relative URL. This will be relative to the current page. If you're in the root of your site, both links will be correct. But if you're on a page in theA
folder, both links will be wrong, as they'll resolve to/A/A/Webform1.aspx
and/A/B/Webform2.aspx
.
Addrunat="server"
to the<a>
tags, and use app-relative paths:
<a runat="server" href="~/A/Webform1.aspx">Sample 1</a>
<a runat="server" href="~/B/Webform2.aspx">Sample 2</a>
ASP.NET将解析相对于应用程序根目录的链接,并为您输出正确的链接。
That way, ASP.NET will resolve the links relative to the root of your application, and will output the correct link for you.
这篇关于未排序列表中的列表项无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!