Login / Register  search  syndication  about

          Ryan Farley's Blog

Ryan Farley on .NET Development with a focus on CRM Development for SalesLogix

Setting the Default Sort for a DataGrid in SalesLogix Web

SalesLogix Web comes with it's own set of controls to be used on QuickForms. These controls are still in their infancy and will likely grow over time, but for now, there are some things missing that might be perceived as limitations. It's helpful to know more about what is under the hood of these OOTB QuickForm controls so you can easily work around limitations and push the controls to behave the way you want them to work.

The DataGrid control in the SalesLogix Web architecture is a very simple control. There's not a lot of “extras” to it at all. One common thing that might be desired with the DataGrid is to specify an initial sort order for it's data. Looking at the properties for the grid in the QuickForms editor, you won't see a way to specify this. However, let's take a look under the hood at the grid control.

The SalesLogix QuickForm controls are located in the assembly named “Sage.SalesLogix.Web.Controls.dll”. If you look at a SmartPart with a grid on it you'll notice that the grid control is actually called “SlxGridView“. If we open that DLL in reflector and navigate to located SlxGridView we can see the following:

Well cool. It inherits from the standard ASP.NET GridView control. We can take a look at the MSDN docs for the GridView control and see all that it contains. Since the SlxGridView control inherits from System.Web.UI.WebControls.GridView, it has everything that we see listed there, including a Sort method.  

We can take what we've learned there and just add some code to a LoadAction for our QuickForm to set the default/initial sort order for the grid. The Sort method takes two parameters. The field or property name to sort by (you can specify multiple properties/fields here, delimited by a comma) and the second parameter indicates the sort direction. I added some code to the LoadAction of the AccountTickets QuickForm to sort the ticket's in descending order by the ReceivedDate property of the Ticket entities listed in the grid.

grdAccountTickets.Sort("ReceivedDate", SortDirection.Descending);

That is it. While the SalesLogix DataGrid control itself didn't have anything built in for specifying a sort programatically, knowing where to look makes this an easy task because we get to see what else it has from it's base type.

What's This?
  
Bookmark and Share

About Ryan Farley

   Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix since 2001 and believes in sharing with the community. He loves C#, Javascript, Python, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

View the SalesLogix Mobile Seveloper Series
View the SalesLogix SData Developer Series
View the Git for the SalesLogix Developer series



Related Content
   Editing Filters in Saleslogix Web Client 8.0
Is it possible to add or remove Saleslogix filters from the List view in Accounts?
Posted on Apr 08, 2014 by SalesLogix Support to SalesLogix Questions & Answers
 
   Bug in the Saleslogix Web LiveGrid Lookup dialog
I recently ran into an issue with the Opportunity Products grid in the Saleslogix web client.  I cli
Posted on Apr 04, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Saleslogix Web Client Controls are Missing
Every so often we hear that a user can no longer add products to an opportunity whether it is a new oppor
Posted on Mar 24, 2014 by Mark Duthoy to SalesLogix Support
 
   Major Problem in Saleslogix v8.1 Cloud Instances
I have been working with a new client who is on the hosted cloud solution for Saleslogix version 8.1.&nbs
Posted on Mar 19, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Setting the Defaults on the Insert Account/Contact Duplicate Record View
When creating a new Account/Contact record in Saleslogix web, you have the ability to check for duplicat
Posted on Mar 10, 2014 by Jason Buss to Jason Buss' Blog
 
Comments

 

CRM Developer said:

A while back I wrote an article on setting the sort for a DataGrid in SalesLogix Web at runtime. That solution worked great in SalesLogix 7.2. However, things changed in SalesLogix 7.5 so I thought it was time for an update to that original post. Let's

March 26, 2009 5:16 PM
 

Aleks said:

Hi All, I'm just trying to sort a datagrid by a couple of properties

grid.Sort("col1,col2", SortDirection.Descending);

delimited by commas, but I'm getting this error:

DataBinding: 'Sage.Platform.ComponentModel.ComponentView' does not contain a property with the name 'Col1,Col2'.

It works fine using only one property.

Any ideas? thanks in advance

October 14, 2010 10:50 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register