MVC Telerik Grid 条件列值?
我如何在 MVC Telerik Grid Control 中获得这项工作
columns.Template(e =>
{
if (e.EndDate>DateTime.Now )
{
@Html.ActionLink("Stop", "StopMedication", "Medication",
new { id = e.PrescriptionID }, new { @class = "standard button" })
}
else {
@Html.ActionLink("Renew", "RenewMedication", "Medication",
new { id = e.PrescriptionID }, new { @class = "standard button" })
}
});
How can i get this work in MVC Telerik Grid Control
columns.Template(e =>
{
if (e.EndDate>DateTime.Now )
{
@Html.ActionLink("Stop", "StopMedication", "Medication",
new { id = e.PrescriptionID }, new { @class = "standard button" })
}
else {
@Html.ActionLink("Renew", "RenewMedication", "Medication",
new { id = e.PrescriptionID }, new { @class = "standard button" })
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下代码片段应该在使用 Razor 语法的 Telerik Grid 模板列中完美运行:
在模板内使用
@
以及使用 @item对象,它代表当前项目(与行相关的实体)及其属性,将允许您启动并运行此模板。The following snippet should work perfectly fine in the Telerik Grid template column using Razor syntax:
Taking use of the
@<text></text>
inside of the template, as well as using the @item object, which represents the current item (entity tied to the row) and it's properties, will allow you to have this template up and running.