back to top

Adding a sort order programtically to a SalesLogix grid control

The SalesLogix grid view control found on quick forms and custom smart parts in SalesLogix is a custom control that is derived from the standard ASP.Net GridView control.  If you look at a deployed quick form you will see that the datasource is rendered to the ascx control markup as a method like this:

protected override void OnAddEntityBindings() {
       dsGrid0.Bindings.Add(new Sage.Platform.WebPortal.Binding.WebEntityListBinding(“Contacts”, grdAccountContacts ));
   dsGrid0.BindFieldNames = new String[] { “Id”,”LastName”,”FirstName”,”IsPrimary”,”WorkPhone”,”Title”,”Address.City”,”Address.State”,”Type”,”Department” };
               
     BindingSource.OnCurrentEntitySet += new EventHandler(dsGrid0_OnCurrentEntitySet);
    
 }

 The data source control is named dsGrid0.  You can see then that it calls a method to bind the fields mentioned to the corresponding columns in the data grid.  The fields are bound in no default order and in order to create a default order you have two options:

1 Create a custom business rule that returns a collection of the entity to be bound with a sort definition added.  Then use the business rule as the binding source, rather than just simply binding to an entity collection

2 Utilize the SlxGridViewSortInfo class to define what the sort should be.  You can then add this code to the page load event (make sure not to run the code on each repaint or the grid can not be sorted by the user).

The SLXGridViewSortInfo has several overloads but the most useful one accepts to parameters, a sort order, and a string expression of the entity property you want to sort by.  This class is contained in the Sage.SalesLogix.Web.Controls namespace in the Sage.SalesLogix.Web.Controls.dll assembly.

To use it you simply do something like this:

Sage.SalesLogix.Web.Controls.SlxGridViewSortInfo s = new Sage.SalesLogix.Web.Controls.SlxGridViewSortInfo(System.Web.UI.WebControls.SortDirection.Ascending, “CreateDate”);

In this sample I am defining the sort to be based on the entity property “CreateDate”.

Then to actually sort a grid you just need to set the CurrentSortExpression to be = to the SLXGridViewSortInfo’s Expression result, like so:

 grdAccountContacts.CurrentSortExpression = s.Expression;

In this sample I am setting the SalesLogix grid named grdAccountContacts to have the sort based on my SLXGridViewSortInfo, aliased as s. 

Depending on the property in your sort condition, the grid will load with the column shown as sorted (if the property in the sort class is a column).  If the sort property is not a column it will still sort but you will see no visual representation that the grid has been sorted in any fashion.

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Kris Halsrud
Kris Halsrud
Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos