Wednesday, June 29, 2011

Convert a dropdown list to LookUp

We have seen how to convert a drop-down list to autocomplete. But in this case we focus on  LookUp.


With the SFS tools you can convert any relationship between entities (natural or custom) in a query to the catalog to select one entity. This is important and convenient when a simple "dropdownlist" is no longer useful to display a large amount of data. Moreover, in a Lookup can do searches as done in the same catalog that owns the relationship (reusable functionality).


  1. Create a sample application 
  2. Understanding how to  configure the entity file for code generation

Step by step

  1. Change the default property (DefaultProperty) from “Contact” in the entity file for code generation.
  2. Add the custom property (CustomProperty) “UILookUp”  to the property “Contact” in the file configuration for generation code “Employee”.
    The file content:
    <?xml version="1.0" encoding="utf-8"?>
    <SfsModel xmlns:xsi="" xmlns:xsd="">
    <Entity Name="Employee" SetName="Employees" IsUIVisible="false" GenerateCRUD="true" IsForLocalization="false" IsCustom="false" IsView="false" DefaultProperty="NationalIDNumber">
    <Property Name="Contact" Nullable="false" Order="100.0000" UIRequired="false" Visible="true" VisibleInGrid="true" VisibleInForm="true" PerformanceOption="Fill" IsNavigationProperty="true" Type="SFSAdventureWorksModel.Contact" MaxLength="0" IsPrimaryKey="false" IsForeignKey="true" IsIdentity="false" IsSearchable="false" IsLocalizable="false" IsDataMember="false" IsCustom="false">
    <CustomProperty Name="UILookUp" Value="true"/>

  3. Re-cretate the code of presentation layer project.
  4. Build the presentation layer project.
  5. Test the application, go to “/SFSAdventureWorks/Employees/CreateGen” in the browser and see that the field “Contact” is now a input field with a icon button. Click in the button for open window with the list of contacts and select the checkbox of any item in the  Contacts list and see the element selected in the field when the window close.
    image  image  image



With SFS Tools is very easy to change the way for display the relationships in the user interface. As the conversion to “autocomplete”, this setting can be used for all cases where the relationships are small catalogs, and as you’ve seen is in minutes.

No comments:

Post a Comment