我正在使用 Telerik 网格来呈现用户收到的备忘录 下面是代码
<%Html.Telerik().Grid<UserManagement.Models.SentMemos>()
.Name("ReceivedMemos")
.Sortable(sorting => sorting
.OrderBy(sortOrder => sortOrder.Add(o => o.MemoDate).Descending()))
.DataBinding(dataBinding => dataBinding
//Ajax binding
.Ajax()
//The action method which will return JSON
.Select("_AjaxBindingReceivedMemos", "OA" )
).
Columns(colums =>
{
colums.Bound(o => o.MemoID).ClientTemplate(Html.ActionLink("Reply", "ReplyMemo", "OA", new { MemoID = "<#=MemoID#>"}, null).ToString()).Title("Reply").Filterable(false).Sortable(false);
colums.Bound(o => o.MemoID).ClientTemplate(Html.ActionLink("Acknowledge", "PreviewMemo", "OA", new { id = "<#=MemoID#>"}, null).ToString()).Title("Acknowledge").Filterable(false).Sortable(false);
colums.Bound(o => o.Subject).ClientTemplate(Html.ActionLink("<%#=Subject#>", "PreviewMemo", "OA", new { id = "<#=MemoID#>" }, null).ToString()).Title("Subject");
//colums.Bound(o => Html.ActionLink(o.Subject,"PreviewMemo","OA",new{id=o.MemoID},null).ToString()).Title("Subject");
colums.Bound(o => o.FromEmployeeName);
colums.Bound(o => o.MemoDate);
})
.Sortable()
.Filterable()
.RowAction((row) =>
{
row.HtmlAttributes.Add("style", "background:#321211;");
})
.Pageable(pager=>pager.PageSize(6))
.PrefixUrlParameters(false)
//.ClientEvents(events => events.OnRowDataBound("onRowDataBound"))
.Render();
%>
在我绑定第三列(主题)的地方,我的意图是制作一个 ActionLink,其中主题是显示文本,我想要一个来自的动态 ID <#=MemoID#>
。备忘录 ID 工作正常,并为我提供了动态备忘录 ID 的链接。问题在于主题,即 ( "<#=Subject#>"
) 在屏幕上呈现原样,而没有映射到备忘录的实际主题。我也尝试过 ( "<%#=Subject%>"
) 但没有任何收获。非常感谢任何帮助
问候