开发者

Ajax.ActionLink() does not fire after putting htmlAttributes

I need to build list of hyperlink(ActionLink) from the collection. After applying htmlAttribute in following code, ActionLink does not trigger back to server.

   @foreach (MillitarySlot slot in item.MondaySlots)
    {
        @Ajax.ActionLink(linkText: @slot.SlotText,
        actionName: "CreateIndex",
        routeValues: new { someId = slot.Id },
        ajaxOptions: new AjaxOptions
        {
           UpdateTargetId = "divCreateSchedule",
            InsertionMode = InsertionMode.Replace,
            HttpMethod = "post"
        },
       //After adding foll开发者_开发百科owing htmlAttribule, view does not trigger call
       htmlAttributes: new { title = slot.ToolTip, style = "color:" + slot.Color }

    }


Try adding a bracket after slot.Color } for example..

   @foreach (MillitarySlot slot in item.MondaySlots)
{
    @Ajax.ActionLink(linkText: @slot.SlotText,
    actionName: "CreateIndex",
    routeValues: new { someId = slot.Id },
    ajaxOptions: new AjaxOptions
    {
       UpdateTargetId = "divCreateSchedule",
        InsertionMode = InsertionMode.Replace,
        HttpMethod = "post"
    },
   //After adding following htmlAttribule, view does not trigger call
   htmlAttributes: new { title = slot.ToolTip, style = "color:" + slot.Color })

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜