Search code examples
asp.net-mvc-4razorwebgrid

How to show image instead of text in WebGrid header


I am trying to use the WebGrid in My MVC 4 application and in my grid I want to display images in header .So please give some example for this, how can I achieve this. I tried searching on internet but didn't get any feasible solution.

Thanks in advance


Solution

  • I tried and succeeded showing image by replacing the header text with image using jQuery Here is my Code Hope it helps someone . Thanks

    $(document).ready(function () {
        $(".webgrid-table th").each(function () {
            var text = $(this).text().trim();
            if (text == "TotalEmail") {
                $(this).html('<img src="/Images/circles.jpg"/>');
            }
        });
    });
    

    Vote Up if you find this answer usefull !