DisplayName Field Control

From Sense/Net Wiki
Jump to: navigation, search
  •  
  •  
  •  
  •  
  • 100%
  • 6.0
  • Enterprise
  • Community
  • Planned

Overview

The DisplayName Field Control is a Field Control that provides an interface to display/modify the DisplayName of Content. The DisplayName is the legible (human-readable) name of Content stored in a ShortText Field defined on GenericContent Content Type.

DisplayName and Name Field Controls

Details

Any kind of special characters are allowed for a DisplayName. Changing the DisplayName of a Content does not affect the portal's standard flow of operation, does not cause broken links in the portal. The Content also have a Name field. The Name and DisplayName relate to each other in many cases. For some Content for example the DisplayName also determines the Name and for other Content the latter determines the former one. Please refer to Content naming to read detailed information on this topic.

Localized display names

It is possible in Sense/Net to localize the display names of content. If you provide a resource key in the correct format ("$classname,keyname") for display name the edit views will show a slightly different field control:

Localized display name

When clicked it is possible to edit the different language variants of the same field. It is also possible to set the value of the field in the displayed dialog.

Editing localized display name

Note: resources will only be saved after saving the content.

Supported Field types

Properties

  • AlwaysUpdateName: (optional) Sets whether the Name should be updated according to input text regardless of using the control in a rename scenario or not. Default is false.

Templates

The DisplayName Field Control is a simple Field Control that renders a single TextBox with some special attributes, and a hidden TextBox to hold the information of whether a Name Field Control is also rendered into the same Content View. In Browse mode simply the value of the Field is rendered.

Browse view template

<%@  Language="C#" %>
<%# DataBinder.Eval(Container, "Data") %>

Edit view template

<%@  Language="C#" %>
<asp:PlaceHolder ID="ResourceDiv" runat="server">
<div class="sn-resdiv">
    <asp:LinkButton ID="ResourceEditorLink" runat="server" />
    <asp:TextBox ID="Resources" runat="server" CssClass="sn-resbox" style="display:none" />
</div>
</asp:PlaceHolder>
<asp:TextBox ID="InnerShortText" CssClass="sn-ctrl sn-ctrl-text sn-urlname-name" runat="server"></asp:TextBox>
<asp:TextBox ID="NameAvailableControl" runat="server" style="display:none"></asp:TextBox>
​

Example/Tutorials

Simple example

   <sn:DisplayName ID="DisplayName1" runat="server" FieldName="Data1" />


Templated example

   <sn:DisplayName ID="DisplayName1" runat="server" FieldName="Data1">
      <EditTemplate><asp:PlaceHolder ID="ResourceDiv" runat="server"><div class="sn-resdiv"><asp:LinkButton ID="ResourceEditorLink" runat="server" /><asp:TextBox ID="Resources" runat="server" CssClass="sn-resbox" style="display:none" /></div></asp:PlaceHolder><asp:TextBox ID="InnerShortText" CssClass="sn-ctrl sn-ctrl-text sn-urlname-name" runat="server"></asp:TextBox><asp:TextBox ID="NameAvailableControl" runat="server" style="display:none"></asp:TextBox></EditTemplate>
   </sn:LongText>

Related links

References