Example #1
0
    protected void unbindCustomField()
    {
        targetCustomField.FieldDefinition.Label    = targetCustomField.FieldDefinition.PortalPrompt = tbFieldLabel.Text;
        targetCustomField.FieldDefinition.DataType =
            (FieldDataType)Enum.Parse(typeof(FieldDataType), ddlDataType.SelectedValue);
        targetCustomField.FieldDefinition.DisplayType =
            (FieldDisplayType)Enum.Parse(typeof(FieldDisplayType), ddlDisplayType.SelectedValue);

        targetCustomField.Name = string.IsNullOrWhiteSpace(tbApiName.Text)
                                     ? Formats.GetSafeFieldName(tbFieldLabel.Text)
                                     : tbApiName.Text;
        targetCustomField.FieldDefinition.IsRequired   = chkRequired.Checked;
        targetCustomField.FieldDefinition.DefaultValue = tbDefaultValue.Text;

        targetCustomField.FieldDefinition.PickListEntries = FieldMetadata.Parse(tbAcceptableValues.Text);
        targetCustomField.FieldDefinition.LookupTableID   = ddlLookupTables.SelectedValue == "0" ? null : ddlLookupTables.SelectedValue;

        targetCustomField.FieldDefinition.ReferenceType = ddlReferenceType.SelectedValue;

        targetCustomField.DisplayOrder = int.Parse(tbDisplayOrder.Text);
        targetCustomField.FieldDefinition.IsRequiredInPortal = chkRequiredInPortal.Checked;
        targetCustomField.FieldDefinition.HelpText           = tbHelpText.Text;
    }