OnMouse event Tooltip for @Html.Grid

吃可爱长大的小学妹 提交于 2019-12-14 03:58:46

问题


I use MVC3 Grid to show Events.

What I need is somehow integrate on mouse event for the "NAME" to show "Description" of the item.

How do I can implement? Thanks for any clue!!!

@{        
    var grid = new WebGrid(source: Model.Events,
    defaultSort: "Name",
    rowsPerPage: 20);
}

@if (Model != null)
{
   @grid.GetHtml(
   tableStyle: "grid",
   headerStyle: "head",
   alternatingRowStyle: "alt",
   rowStyle: "row",
   selectedRowStyle: "selected-row",
   columns: grid.Columns(
   grid.Column("Name", "Event", style: "column"),                                            
   grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { id = item.ID }), style: "column-action")
   ) )
}

回答1:


You can try using the "format" property to insert some raw HTML. Instead of this:

grid.Column("Name", "Event", style: "column")

try this:

grid.Column(columnName: "Name", header: "Event", format: (i) => @Html.Raw("<span title='" + i.Name + "'>" + i.Description + "</span>") )


来源:https://stackoverflow.com/questions/10157531/onmouse-event-tooltip-for-html-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!