使Keydown(enter)在选择选项卡索引时触发Ajax.ActionLink

本文关键字:索引 ActionLink Ajax 选项 Keydown enter 选择 | 更新日期: 2023-09-27 18:31:01

谁能在这里帮我?我希望通过按回车键来触发这个(下面):

<div id="create_new" tabindex="2">
 @Ajax.ActionLink("Create New",
    "create_new", new AjaxOptions { 
    UpdateTargetId="accordion",
    InsertionMode= InsertionMode.Replace,
    HttpMethod = "GET"
    })
 </div>

使Keydown(enter)在选择选项卡索引时触发Ajax.ActionLink

这对

我有用:

<div id="create_new">
@Ajax.ActionLink("Create New",
"create_new", "controller_name", null, new AjaxOptions
{
    UpdateTargetId = "accordion",
    InsertionMode = InsertionMode.Replace,
    HttpMethod = "GET"
}, new { tabindex = 2}
)
</div>

只需在链接中使用选项卡索引而不是div。