Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
@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>
        )



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.
Posted

C#
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.............
 
Share this answer
 
Comments
Member 10620863 4-Mar-14 23:14pm    
Thank u
Ultimately the column should be removed from the DOM Tree, it won't work just by hiding column
Following will work
$("#" + <<You gridID >> + ".WFGrid > thead > tr > th:contains('" + headerName + "')").remove();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900