Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

Populating a ComboBox with picklists in the SalesLogix web

Here is a quick and easy way of populating a combo box control with a specific SalesLogix picklist’s values.

First, you can use the Picklist class in the Sage.SalesLogix.Picklists.dll assembly.

Lets say I have a picklist called “Vendor”.  To retrieve these values I can call this one line, using the GetPicklistItemsByName function:

System.Collections.Generic.IList<Sage.SalesLogix.PickLists.PickList> picklists = Sage.SalesLogix.PickLists.PickList.GetPickListItemsByName("Vendor", true);

Note that the function takes 2 parameters, the picklist you want to retrieve values for and a Boolean switch of returning the list in alphabetic order.

Now with that I can simply set a combo box’s DataSource property and call DataBind:

ComboBox1.DataSource = picklists;
ComboBox1.DataBind();

One other thing to note, it is typically a good idea to initialize a combo box with a blank line so that the user is forced to choose something.  You can do this via a line like this:

ComboBox1.Items.Insert(0, new ListItem(" ", " "));

The other thing to consider with doing something like that is that in order to allow a combination of manually inserted list items and a data bound list you need to set a property of the list box to allow appending data bound items after manually added items.  This looks like:

ComboBox1.AppendDataBoundItems =true;

Lets look at a full sample:

ComboBox1.Items.Clear();
ComboBox1.Items.Insert(0, new ListItem(" ", " "));
System.Collections.Generic.IList<Sage.SalesLogix.PickLists.PickList> picklists = Sage.SalesLogix.PickLists.PickList.GetPickListItemsByName("Vendor", true);
ComboBox1.DataSource = picklists;
ComboBox1.DataBind();

 

What's This?
  
Bookmark and Share

About Kris Halsrud

   Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.


Related Content
   Adding Filters to the Lookup Control at Runtime in the Infor CRM (formerly Saleslogix) Web Client
To add a new Lookup Pre-filter you can add code such as this on a quick form:LookupPreFilter preFilter =
Posted on Dec 22, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Easily Showing and Hiding Tabs at Runtime in Infor CRM (Saleslogix)
Showing and hiding tabs in the Infor CRM (Saleslogix) client should be an easy thing. It should be someth
Posted on Dec 16, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Problem setting SLXTextbox enabled property / Setting unexposed base control properties for a custom control
I recently had an issue with a Quickform where I was attempting to set the Enabled property of a TextBox
Posted on Dec 05, 2014 by Jason Buss to Jason Buss' Blog
 
   Checking Infor CRM (Saleslogix) Picklists for valid data
This week I received a question about a particular picklist. One of the picklist items, when chosen, wou
Posted on Dec 05, 2014 by Dale Richter to Infor CRM Questions & Answers
 
   Avoiding the Dirty Data Message When Programatically Redirecting to a Record in Infor CRM (Saleslogix)
In my last post I wrote about using the OnClientClick property of a control (or button) to run JavaScript
Posted on Dec 02, 2014 by Ryan Farley to Ryan Farley's Blog
 
Comments

 

Twitter Trackbacks for Populating a ComboBox with picklists in the SalesLogix web - Kris Halsrud's Blog [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 Populating a ComboBox with picklists in the SalesLogix web - Kris Halsrud's Blog         [customerfx.com]        on Topsy.com

April 30, 2010 10:36 AM
 

Joe Tame said:

Kris,

I loaded the assembly and tried to use the class in my code, I'm getting

The type 'Sage.SalesLogix.Orm.EntityBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'Sage.SalesLogix, Version=7.5.3.4227, Culture=neutral, PublicKeyToken=null'.

Any idea what I'm doing wrong ?  I'm using 7.5.3.

thanks

JT

April 30, 2011 9:16 PM
 

Kris Halsrud said:

Are you adding this to a business rule?  If so you need to add a reference to the mentioned assembly in the business rules assembly reference definitions.  If you add this code to a quick form directly via a c# snippet action then you don't need to do this as the Quickforms do not rely on explicit references needed for the rules that are consolidated into their own assemblies.

May 2, 2011 8:24 AM
 

Samantha Knigge said:

Kris,

I'm trying to use a combo box in a C# snippet on a form load event. When I try to define the comboxbox1.datasource, it doesn't display the datasource property in intellisense. We're version 7.5.4.

What am I missing? I'd like to dynamically populate my combobox from an entity and add a filter.

Thanks so much!

Samantha

May 7, 2012 5:01 PM
 

Kris Halsrud said:

Samantha the intellisense built into the Application Architect is nowhere near complete.  You will have to open the deployed smartpart in Visual Studio from within your website to have full intellisense.

May 7, 2012 5:49 PM

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