我正在尝试通过 ajax 加载数据的 Jquery UI 选项卡。链接以编程方式生成。
string LinkID = "";
<ul>
@foreach (MyItem item in Model.ItemList)
{
<li>
LinkID = "subcat" + ViewBag.F_ID + "-tabs-item" + item.ID + "-link";
@Html.ActionLink( item.Name, //Link Text
"GetItem", //Action Name
"Items", //Controller Name
//Route Values
new { C_ID = ViewBag.C_ID, D_ID = ViewBag.D_ID, E_ID = ViewBag.E_ID, F_ID = ViewBag.F_ID, G_ID = ViewBag.G_ID, Item_ID = item.ID },
//HTML Attributes
new { id = LinkID, @class = "ItemLoadViaAjax", title = item.Name })
</li>
}
</ul>
生成的锚元素:
<a class="ItemLoadViaAjax"
href="#Cadbury_Eclairs"
id="subcat11-tabs-item9-link"
title="Cadbury Eclairs">
Cadbury Eclairs
</a>
该href
值与 的值相同title
,而不是从 ActionLink 生成的 URL。
知道为什么会这样吗?