DatePicker Field Control

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

Overview

The DatePicker is a field control that handles DateTime Fields and provides an easy way to select the date you want to store.

DatePicker

Details

Supported Field types

Properties

  • ScriptDisabled: when set to true the datepicker-related javascripts will not be executed.
  • ServerDateFormat: the date pattern used when displaying a stored value.
  • Configuration: the JSON configuration object for configuring the jQuery UI datepicker. Default is {format:'Y.m.d',allowBlank:true}.

For a complete list of common Field Control properties see common Field Control properties.

Templates

In Browse view, the DatePicker simply displays the string representation of the date and time. In Edit view, it contains two controls for date and time.

Browse view template

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

Edit view template

<%@ Language="C#" %>
<asp:PlaceHolder ID="InnerDateHolder" runat="server">
    Date <asp:TextBox ID="InnerControl" runat="server" CssClass="sn-ctrl sn-ctrl-text sn-ctrl-date" style="width:100px;"></asp:TextBox>
</asp:PlaceHolder>
<asp:PlaceHolder ID="InnerTimeHolder" runat="server">
    Time <asp:TextBox ID="InnerTimeTextBox" runat="server" CssClass="sn-ctrl sn-ctrl-text sn-ctrl-time" style="width:100px;"></asp:TextBox>
</asp:PlaceHolder>
<asp:Label ID="DateFormatLabel" runat="server" CssClass="sn-iu-desc" /><br /><asp:Label ID="TimeFormatLabel" runat="server" CssClass="sn-iu-desc" />

Example/Tutorials

Simple example

   <sn:DatePicker runat="server" FieldName="ValidTill" ScriptDisabled="false" ServerDateFormat="yyyy.MM.dd" />

Templated example

   <sn:DatePicker runat="server" FieldName="ValidTill" ScriptDisabled="false" ServerDateFormat="yyyy.MM.dd">
      <EditTemplate>
         <asp:PlaceHolder ID="InnerDateHolder" runat="server">
            Date <asp:TextBox ID="InnerControl" runat="server" CssClass="sn-ctrl sn-ctrl-text sn-ctrl-date" style="width:100px;"></asp:TextBox>
         </asp:PlaceHolder>
         <asp:PlaceHolder ID="InnerTimeHolder" runat="server">
            Time <asp:TextBox ID="InnerTimeTextBox" runat="server" CssClass="sn-ctrl sn-ctrl-text sn-ctrl-time" style="width:100px;"></asp:TextBox>
         </asp:PlaceHolder>
         <asp:Label ID="DateFormatLabel" runat="server" CssClass="sn-iu-desc" /><br /><asp:Label ID="TimeFormatLabel" runat="server" CssClass="sn-iu-desc" />
      </EditTemplate>
   </sn:DatePicker>

Related links

References