Home  Forums  Blogs  Knowledge Base  FAQs  Documentation  Marketplace  Support 
This article describes how to display text values from the drop-down list's "key;value" pair on the live site using transformation.
You have a drop-down field with pair values like:
1;Nokia
2;Sony Ericsson
3;Motorola


And now on the site you want to display the values in the drop-down and not the keys.
It is needed to hard code decision logic directly in the transformation. Please find the example below:

<script runat="server">
string GetName(object CodeName) {
    if (CodeName != null) {
        string Code = CodeName.ToString();
        switch (Code) {
          case "1": return "Nokia";break;
          case "2": return "Sony Ericsson"; break;
          case "3": return "Motorola"; break;
        }
    }
    return (string)CodeName;
}
</script>
Manufacturer:<%# GetName(Eval("ManufacturerId")) %>


See also: Or our sample E-commerce site: Site Manager -> Development -> Document types -> Product - Laptop -> Transformations -> Default

Applies to: Kentico CMS 3.x
Created on 9/24/2008 4:46:08 AM
 


Sitemap | Copyright 2008 Kentico software | Powered by Kentico