在mvc中隐藏webgrid中的特定列! [英] Hide particular column in webgrid in mvc!

查看:97
本文介绍了在mvc中隐藏webgrid中的特定列!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

@grid.GetHtml(
    fillEmptyRows: true,
    alternatingRowStyle: "alternate-row",
    headerStyle: "grid-header",
    footerStyle: "grid-footer",
    mode: WebGridPagerModes.All,
    firstText: "<< First",
    previousText: "< Prev",
    nextText: "Next >",
    lastText: "Last >>",
    columns: new [] {
    //grid.Column("CourseId", canSort: false),
    grid.Column("Ordinal"),
    grid.Column("CourseName",header:"Course Name"),
    grid.Column("CourseDisplatTitle",header:"Description"),
    grid.Column("LanguageName",header:"Language"),
    grid.Column("ThemeName",header:"Theme"),
    grid.Column("Enabled",header:"Active"),
    grid.Column("FriendlyId", style:"hidecol",header:""),

    grid.Column("",
     header: "Actions",
     format: @<text>
     @Html.ActionLink("Edit",   "EditCourse",   new { id=item.CourseId} )
      |
     @Html.ActionLink("Delete", "Delete", new { id=item.CourseId} )
     </text>
        )







我想隐藏这个列grid.Column(FriendlyId,样式: hidecol,标题:),

在hidecol css中我调用display:none所以它只隐藏数据而不是标题,我正在做空白标题但是显示了这个FriendlyId。

我们如何用数据和标题隐藏整个列。




I want to hide this column grid.Column("FriendlyId", style:"hidecol",header:""),
in hidecol css i am calling display:none so it hiding data only not header and i am doing blank header but showing this FriendlyId.
How we hide this whole column with data and header.

推荐答案

grid.Column("FriendlyId", style:"hidecol",header:"")

Instead of using like this you have to use Like bellow manner I tried It will work successfully.

grid.Column(format: @<input type="hidden" name="FriendlyId" value="@item.FriendlyId" />)





快乐编码.............



Happy coding.............


最终应该从DOM树中删除该列,它赢了仅仅通过隐藏栏来工作

以下将工作
Ultimately the column should be removed from the DOM Tree, it won't work just by hiding column
Following will work


(#+<<你gridID>> + .WFGrid> thead> tr> th:contains('+ headerName +'))。remove();
("#" + <<You gridID >> + ".WFGrid > thead > tr > th:contains('" + headerName + "')").remove();


这篇关于在mvc中隐藏webgrid中的特定列!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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