Exemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (_datatype.HasSettings())
            {
                DataEditorSettingsStorage ss = new DataEditorSettingsStorage();

                List <Setting <string, string> > s = ss.GetSettings(_datatype.DataTypeDefinitionId);
                ss.Dispose();

                _datatype.LoadSettings(s);
            }

            this.Controls.Add(Control);
        }
Exemplo n.º 2
0
        protected void LoadSettings()
        {
            DataEditorPropertyPanel pnlType = new DataEditorPropertyPanel();

            pnlType.Text = ui.Text("dataBaseDatatype");

            _dropdownlist    = new DropDownList();
            _dropdownlist.ID = "dbtype";

            _dropdownlist.Items.Add(DBTypes.Date.ToString());
            _dropdownlist.Items.Add(DBTypes.Integer.ToString());
            _dropdownlist.Items.Add(DBTypes.Ntext.ToString());
            _dropdownlist.Items.Add(DBTypes.Nvarchar.ToString());

            DataEditorPropertyPanel pnlPrevalue = new DataEditorPropertyPanel();

            pnlPrevalue.Text = ui.Text("prevalue");

            _textbox         = new TextBox();
            _textbox.ID      = "prevalues";
            _textbox.Visible = _displayTextBox;

            // put the childcontrols in context - ensuring that
            // the viewstate is persisted etc.

            pnlType.Controls.Add(_dropdownlist);
            Controls.Add(pnlType);

            if (_displayTextBox)
            {
                pnlPrevalue.Controls.Add(_textbox);
                Controls.Add(pnlPrevalue);
            }


            foreach (KeyValuePair <string, DataEditorSetting> kv in _datatype.Settings())
            {
                DataEditorSettingType dst = kv.Value.GetDataEditorSettingType();
                dtSettings.Add(kv.Key, dst);

                DataEditorPropertyPanel panel = new DataEditorPropertyPanel();
                panel.Text  = kv.Value.GetName();
                panel.Text += "<br/><small>" + kv.Value.description + "</small>";


                if (_datatype.HasSettings())
                {
                    DataEditorSettingsStorage ss = new DataEditorSettingsStorage();

                    List <Setting <string, string> > s = ss.GetSettings(_datatype.DataTypeDefinitionId);
                    ss.Dispose();

                    if (s.Find(set => set.Key == kv.Key).Value != null)
                    {
                        dst.Value = s.Find(set => set.Key == kv.Key).Value;
                    }
                }

                panel.Controls.Add(dst.RenderControl(kv.Value));

                Label invalid = new Label();
                invalid.Attributes.Add("style", "color:#8A1F11");
                invalid.ID = "lbl" + kv.Key;
                panel.Controls.Add(invalid);

                this.Controls.Add(panel);
            }
        }