ActionLink Problem with Client Template Telerik MVC grid
Posted
by Tassadaque
on Stack Overflow
See other posts from Stack Overflow
or by Tassadaque
Published on 2010-06-15T06:48:44Z
Indexed on
2010/06/15
6:52 UTC
Read the original article
Hit count: 1610
Hi,
i m using Telerik grid to present memos received by user below is the code
<%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();
%>
where i m binding third column (Subject) my intention is to make an ActionLink where subject is the display text and i want a dynamic ID coming from <#=MemoID#>. memo id is working fine and gives me a link with dynamic Memo IDs. the problem is with the subject i.e ("<#=Subject#>") is rendered as it is on the screen without mapping to the actual subject of the memo. i have also tried ("<%#=Subject%>") but to no gain. any help is highly appriciated
regards
© Stack Overflow or respective owner