MVC3 WebGrid操作链接文本动态变化 [英] Mvc3 webgrid action link text vary dynamically

查看:72
本文介绍了MVC3 WebGrid操作链接文本动态变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

Hi All

@appsGrid.GetHtml(
   tableStyle: "table",
   headerStyle: "head",
   alternatingRowStyle: "alt",
            columns: appsGrid.Columns(
                appsGrid.Column(columnName: "Code",
                                header: "",
                                         format: (item) => Html.ActionLink("Details",
                                                                  "Index",
                                                                  "ApplicationTechStack",
                                                                  new {Code = item.Code},
                                                                  null
                                                                 ),





但是,当我尝试将行更改为format时:(item)=> Html.ActionLink(item.Code,它给我错误.怎么来了?该项目属于具有Code属性的类,在其他部分可见-返回路由值就很好了...需要做些什么才能动态显示超链接文本?哦,我在MVC 3上.





However, when I try to change the line to format: (item) => Html.ActionLink(item.Code, it gives me error. How come? item is of class that has Code property, as visible in other parts - returns routing values just fine... What needs to be done to display the hyperlink text dynamically? Oh, I''m on MVC 3.

推荐答案

< a href ="http://stackoverflow.com/questions/4570193/razor-mvc- 3-rc2-webgrid-actionlink-with-dynamic-text"> http://stackoverflow.com/questions/4570193/razor-mvc-3-rc2-webgrid-actionlink-with-dynamic-text</a> [ < a href ="http://stackoverflow.com/questions/4570193/razor-mvc-3-rc2-webgrid-actionlink-with-dynamic-text" target ="_ blank" title ="New Window"> ^ </a>]
<a href="http://stackoverflow.com/questions/4570193/razor-mvc-3-rc2-webgrid-actionlink-with-dynamic-text">http://stackoverflow.com/questions/4570193/razor-mvc-3-rc2-webgrid-actionlink-with-dynamic-text</a>[<a href="http://stackoverflow.com/questions/4570193/razor-mvc-3-rc2-webgrid-actionlink-with-dynamic-text" target="_blank" title="New Window">^</a>]


这篇关于MVC3 WebGrid操作链接文本动态变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆