如何把更多的列的WebGrid在MVC3 [英] How to put additional column to WebGrid in MVC3

查看:85
本文介绍了如何把更多的列的WebGrid在MVC3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的WebGrid帮助,使我的MVC应用网格排序。

I am using WebGrid helper to make grid sortable in my MVC application.

@{
        var grid = new WebGrid(Model, canSort:true );
        @grid.GetHtml( columns:grid.Columns(

                grid.Column( "Username", "Full Name", canSort:true ),
                grid.Column("Profile","Profile", canSort:false)
            ));
   }       

排序的列将覆盖(显示链接)标题的默认样式我怎能维护?

在最后一栏我有形象的行动,这将使用JavaScript对话框打开弹出

In last column I have image action which will open popup using javascript dialog

 <img  title="View Detail" style="cursor: pointer" onclick="openPopup('@item.EncryUserId')"
                            src="@Url.Content("~/Content/Images/view-fullscreen.png")" />

我如何添加使用的WebGrid这个附加列?

感谢。

推荐答案

最后我得到了以下

   grid.Column(header: "Details",
                format: @<text><img src="@Url.Content("~/Content/Images/view-fullscreen.png")"
                 style="cursor: pointer" onclick="openPopup('@item.EncryUserId')"                                                                        
                 alt="View Detail" title="View Detail"/></text>) 

和里面的头有锚标记,所以我增加了 headerStyle:tdheader
并添加新的风格的 .tdheader一个{颜色:白};

and inside header there is anchor tag so i have added headerStyle: "tdheader" and add new style .tdheader a{ color: white};

这篇关于如何把更多的列的WebGrid在MVC3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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