コード例 #1
0
        /// <summary>
        /// Saves this instance.
        /// </summary>
        public override void Save()
        {
            lock (m_Locker)
            {
                var prevalues = new List <object>();

                // Set settings
                if (this._settings == null)
                {
                    this._settings = DtgHelpers.GetSettings(this.m_DataType.DataTypeDefinitionId);
                }

                this._settings.ShowLabel      = this._showLabel != null && this._showLabel.Checked;
                this._settings.ShowGridHeader = this._showHeader != null && this._showHeader.Checked;
                this._settings.ShowGridFooter = this._showFooter != null && this._showFooter.Checked;
                this._settings.ReadOnly       = this._readOnly != null && this._readOnly.Checked;
                this._settings.TableHeight    = this._tableHeight != null?int.Parse(this._tableHeight.Text) : 300;

                prevalues.Add(this._settings);

                // Add existing prevalues;
                foreach (var t in this._preValues)
                {
                    var parsedprevalue = ParsePrevalue(t);

                    if (parsedprevalue != null)
                    {
                        prevalues.Add(parsedprevalue);
                    }
                }

                // Add last (new) prevalue
                var newprevalue = ParsePrevalue(this._newPreValue);

                if (newprevalue != null)
                {
                    prevalues.Add(newprevalue);
                }

                if (prevalues.Count > 0)
                {
                    // Delete former values
                    PreValues.DeleteByDataTypeDefinition(this.m_DataType.DataTypeDefinitionId);

                    // Add new values
                    AddPrevalues(prevalues);

                    // Must not refresh on initial load. [LK]
                    if (prevalues.Count > 1)
                    {
                        // Reload IFrame to show changes
                        this.Page.Response.Redirect(this.Page.Request.Url.ToString());
                    }
                }
            }
        }