有关MVC3中用到Html.Telerik().Grid()的绑定问题, 急!
具体代码为:
@(
Html.Telerik().Grid((IEnumerable<dynamic>)ViewData["t_newtask"]).Name("Grid1").DataKeys(dataKeys => dataKeys.Add("SID"))
.Columns(columns =>
{
columns.Template(@<text><a href="@Url.Action("Index", "Section", new { id = item.SID})" style=" text-align:left;">@item.SID</a></text>).HtmlAttributes(new { style="align:bottom; text-align:center"}).Title("Task ID").Width(80);
columns.Bound("Company").Width(80);
columns.Bound("ContactName").Width(80);
columns.Bound("Phone").Width(120);
columns.Bound("Email").Width(180);
columns.Bound("Country").Width(80);
columns.Bound("Language").Width(80);
columns.Bound("CreationDate").Width(200).Title("CreationDate").Format("{0:yyyy/MM/dd hh:mm:ss}");
}).TableHtmlAttributes(new { style = "line-height:18px;border-spacing:0;margin:0;background-color:#c8e8f8;"})
.DataBinding(dataBinding => dataBinding.Ajax().Select("Selectnewtask", "Home"))
.Pageable()
.Sortable()
//.Groupable()
//.Selectable()
.Filterable())
@*//.RowAction(row =>row.DataItem.SID.Equals(TempData["sid"]))))*@
@*.RowAction(row => row.Selected = true)*@
请问怎么实现: 在排序不刷新页面时,能将Task ID字段作为超链接跳转到具体页面????
------解决方案--------------------C# code
Html.Telerik().Grid((IEnumerable<dynamic>)ViewData["t_newtask"]).Name("Grid1").DataKeys(dataKeys => dataKeys.Add("SID"))
------解决方案--------------------
使用 ClientTemplate 如:
columns.Template(o =>
Html.ActionLink("Resend", "AddAlerts?msgId=" + o.TPAlertMessageId)
)
.ClientTemplate("<a href='/Alerts/AddAlerts?msgId=<#= TPAlertMessageId #>'>Resend</a>")
.Width("150px")
.Title("Action");