Bumble
Bumble

Reputation: 557

Adding image to MVC 3 Web grid column header

recently i am using Web grid of MVC 3 . In one of the columns i need to display a image next to header text . Eg: + is this possible with MVC Web grid.

thx

Upvotes: 2

Views: 2888

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039368

Currently this is not possible unless you use CSS (provide the column header a style and set a background image in your CSS) or javascript.

Example with CSS3:

@grid.GetHtml(headerStyle: "header", columns: grid.Columns(
    grid.Column("Id"),
    grid.Column("Title")
))

and then in order to set some background image in the second column header using CSS3:

<style type="text/css">
.header th:nth-child(2) {
    background-image: url(foo.png);
}
</style>

Upvotes: 3

Related Questions