Docs / Development / Binary Field Control

Binary Field Control

Although this feature is supported in sensenet 7, it is built on the old Web Forms technology that you should not use for new projects. We encourage you to use a more modern UI solution using our client-side packages.

The Binary Field Control is a Field Control that handles Binary Fields and provides an interface to modify binary data of a Content.

With Binary Field Control the binary data of a Content can be added/modified. Depending on the configuration of the Field and the Content Type and extension, the control is rendered as a textarea where you can edit the binary manually or as a fileupload control allowing you to upload a new file. By default an upload control is rendered. A textarea is rendered when:

Supported Field types



Binary field control renders the name of the assigned file as a hyperlink in Browse mode. In Edit mode a fileupload control or a textarea control is rendered.

Browse view template

<%@  Language="C#" %>
<%@ Import Namespace="SenseNet.Portal.UI.Controls" %>
<a href='<%# ((Binary)Container).Field.Content.Path %>'><%# ((Binary)Container).Field.Content.DisplayName %></a>

Edit view template

<%@  Language="C#" %>
<asp:TextBox ID="BinaryTextBox" runat="server" TextMode="MultiLine" CssClass="sn-ctrl sn-ctrl-textarea" Rows="50" Columns="100" />
<asp:FileUpload CssClass="sn-ctrl sn-ctrl-upload" ID="FileUploader" runat="server" Visible="false" />


Simple example

   <sn:Binary ID="BinaryCtrl" runat="server" FieldName="Data1" />

This next example displays the Field Control for editing in full screen.

   <sn:Binary ID="BinaryCtrl" runat="server" FieldName="Data1" RenderMode="Edit" FullScreenText="true" />

Templated example

   <sn:Binary ID="BinaryCtrl" runat="server" FieldName="Data1">
         <asp:TextBox ID="InnerControl" runat="server" TextMode="MultiLine"></asp:TextBox>
         <asp:FileUpload ID="FileUploader" runat="server" Visible="false" />

Is something missing? See something that needs fixing? Propose a change here.