I have a grid that implements advanced databinding (ie it used the NeedDataSource event to bind the grid). This grid uses the command item template and has some controls in it. It also uses custom sorting (ie it handles the GridSortCommand). I handle all sorting at the database end of things, which is why I implement Custom Sorting. Everything works fine, except I have noticed that the NeedDataSource event fires before the GridSortCommand Event. This causes my datagrid to rebind, then I handle the sort event and specify the sort parameters and rebind the grid. So, the grid essentially binds twice which is not efficient. The reason I brought up the CommandItemTemplate, is that I noticed that when the grid ItemCommand event occurs, the NeedDataSource event never fires unless I explicitly call Grid.Rebind(). This second event sequence makes sense to me and I am able to create the custom binding parameters prior to rebinding the grid.
However, in the sort scenario, this does not work. My basic question is... how do I get custom sorting to work properly with advanced databainding. I am sure there is some good reason to have the NeedDatSource event automatically fire prior to sorting in a built-in sorting scenario. However, with custom sorting, this causes problems.
However, in the sort scenario, this does not work. My basic question is... how do I get custom sorting to work properly with advanced databainding. I am sure there is some good reason to have the NeedDatSource event automatically fire prior to sorting in a built-in sorting scenario. However, with custom sorting, this causes problems.