2012-04-14 40 views
1

我使用MVC3 Grid來顯示事件。OnMouse事件工具提示@ Html.Grid

我需要的是以某種方式集成在鼠標事件的「名稱」顯示該項目的「說明」。

我該如何執行?感謝您的任何線索!

@{   
    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") 
    )) 
} 
+0

@Ohgodwhy的問題是,我不知道如何下手:( – 2012-04-14 21:47:15

回答

1

您可以嘗試使用「format」屬性插入一些原始HTML。取而代之的是:

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

試試這個:

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

謝謝您的幫助! – 2012-04-14 21:55:12