Example #1
0
    /// <summary>
    /// Handles the Click event of the btnSubmit control.
    /// </summary>
    private void btnSubmit_Click(object sender, EventArgs e)
    {
        if (EditEnabled && propertiesForm.SaveData(null, false))
        {
            var properties = new NameValueCollection();
            propertiesForm.Fields.ForEach(fieldName =>
            {
                var fieldDataType = propertiesForm.FormInformation.GetFormField(fieldName).DataType;
                var fieldValue    = propertiesForm.Data.GetValue(fieldName);
                var value         = DataTypeManager.GetStringValue(TypeEnum.Field, fieldDataType, fieldValue, CultureHelper.EnglishCulture);

                properties.Add(fieldName, value);
            });

            try
            {
                WidgetService.StoreWidgetProperties(widgetInstanceGuid, properties);
                hdnSaveStatus.Value = "1";
            }
            catch (InvalidOperationException exception)
            {
                Service.Resolve <IEventLogService>().LogException("Newsletter", "SAVEWIDGETPROP", exception);
            }
        }
    }