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

时间:2013-09-11 15:55:52

标签: c# jquery html asp.net ajax

有人可以帮我吗? 我想通过按Enter键来触发这个(下面):

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

1 个答案:

答案 0 :(得分:0)

这对我有用:

<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>

只需在链接中使用tabindex而不是div。