Grid SortButtonFor Link issue

Jul 23, 2012 at 3:54 AM

I've just started playing around with the toolkit and I'm having a bit of an issue with the grid. 

Everything works great, except when I change the SortButtonStyle from Button to link.

The header does show up as a link, but no data is displayed.  I'm basing everything off the basic sample.

 

<td class="PersonHeader"><strong>@item.SortButtonFor(m => m.FullName, sortButtonStyle: SortButtonStyle.Link)</strong></td>

 

I've also tried it with no SortButtonStyle specified, same problem.

 

Anyone else seen this?  There is nothing in my javascript debug output or in VS.

Coordinator
Jul 23, 2012 at 9:14 AM

Hi DannOh, it works for me! Please download the BasicTutorialsCode file and open the razor example (the first razor example, not the one with "filter" near it). There you will see the same sortbutton you used, change to Link...and it will work. 

However pay attention the causePostback parameter of the enableSortingFor helper is set to false, this mean that sorting is not performed immediately, but just on submit. Set it to true to have an immediate post ...and an immediate sorting. 

Moreover, multisortin is also on this means you can sort using several columns...so maybe there is already a sorting on another column...that is why it seems that clicking your column...nothing happens.

Jul 24, 2012 at 2:38 AM

Thanks, I hadn't added the EnableSortingFor, for whatever reason that didn't make a difference with buttons, but made a big difference when changed to a link :)