Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 如何在MVC3中向WebGrid添加附加列_Asp.net Mvc 3 - Fatal编程技术网

Asp.net mvc 3 如何在MVC3中向WebGrid添加附加列

Asp.net mvc 3 如何在MVC3中向WebGrid添加附加列,asp.net-mvc-3,Asp.net Mvc 3,我正在使用WebGrid helper在我的MVC应用程序中使网格可排序 @{ var grid = new WebGrid(Model, canSort:true ); @grid.GetHtml( columns:grid.Columns( grid.Column( "Username", "Full Name", canSort:true ), grid.Column("Profile","P

我正在使用WebGrid helper在我的MVC应用程序中使网格可排序

@{
        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对话框打开弹出窗口

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

如何使用WebGrid添加此附加列?

谢谢。

grid.Column(格式:
grid.Column(format: 
    @<img title="View Detail" style="cursor: pointer" onclick="openPopup('@item.EncryUserId')" src="@Url.Content("~/Content/Images/view-fullscreen.png")" />
)
@ )
最后我得到了如下答案

   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>) 
grid.Column(标题:“详细信息”,
格式:@)
在页眉内部有锚定标签,所以我添加了页眉样式:“tdheader”
并添加新样式.tda{color:white}

谢谢您的帮助,但是您错过了@text,它负责在(@)代码部分中包含html。。