Display user lookup as a dropdown (legacy-web style)
Nicolas Galler | September 1, 2009Our users upgraded from 7.0 to 7.5 complained about the user lookup dialog – on 7.0 it used to be a dropdown, whereas on 7.5 it’s a popup similar to the LAN client.
Sorry for the chopped image, I had to hide the name and was too lazy to re-run on the eval db.
The problem is the popup takes a couple seconds to come up on IE7, sometimes more on slow machines or slow connections – it’s a bit irritating. After a brief phase of denial (how dare they refuse the New and Improved way, etc) I set to work. Had to struggle a bit with the combination of available properties but finally got it working. Configuring lookup is definitely a big pain on the web client! This is the winning combo:
- Display Mode = DropDownList
- Display Property = UserInfo.UserName
- Lookup Entity Name = User
- Lookup Binding Mode = Object
- In the Lookup Pre Filters, add a filter on “Enabled” (make sure the property is populated as System.Boolean, and set OperatorCode to “=”) and filter value of “true”
The DropDown style lookups are a bit more picky on the parameters than the regular lookup, because they actually use NHibernate parameters instead of inline HQL. In general I would say it is a good thing to use parameters, though in this case it makes it a bit harder for us to hack around the limitation of the control.
Data binding works fine, the only big problem I have found is that it sorts by first name instead of last name for some reason (which you can’t really see in the screen shot as I removed the last name but you can imagine).






Update – on 7.5.2 I can get around the sorting issue by using DropDownDisplayProperty = UserInfo.LastName. The control is not able to handle the period in the name so it still displays LastName, FirstName – but it does use the Lastname for sorting. Yay! I did not test that work-around on 7.5.1, it might have worked there also.