4

I am using WebGrid helper to make grid sortable in my MVC application.

@{
        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)
            ));
   }       

Sortable column will override(display blue link) default style of header how can I maintain that?

In last column I have image action which will open popup using javascript dialog

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

How can I add this additional column using WebGrid?

Thanks.

Athanasios Emmanouilidis
  • 2,084
  • 3
  • 18
  • 30
Arun Rana
  • 8,426
  • 14
  • 67
  • 107

2 Answers2

4

Finally I got answer as per below

   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>) 

and inside header there is anchor tag so i have added headerStyle: "tdheader" and add new style .tdheader a{ color: white};

Arun Rana
  • 8,426
  • 14
  • 67
  • 107
1
grid.Column(format: 
    @<img title="View Detail" style="cursor: pointer" onclick="openPopup('@item.EncryUserId')" src="@Url.Content("~/Content/Images/view-fullscreen.png")" />
)
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928