protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            AddBeforeSaveClientScript();
            var store = LookupBox.GetStore();

            if (store == null || store.Proxy == null || store.Proxy.Primary == null)
            {
                return;
            }

            var proxy = (AjaxProxy)store.Proxy.Primary;
            var dataSourceTypeName = proxy.ExtraParams["dataSourceType"];

            if (string.IsNullOrEmpty(dataSourceTypeName))
            {
                return;
            }

            var sourceView = (BaseDataSourceView <long>)Activator.CreateInstance(BuildManager.GetType(dataSourceTypeName, true, true));

            LookupBox.TableName   = sourceView.TableName;
            LookupBox.WindowTitle = ((IHeaderControl)sourceView).Header;
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (!string.IsNullOrEmpty(ComboboxView))
            {
                var type = BuildManager.GetType(ComboboxView, true, true);
                ComboboxViewListConfig = (IListConfig)Activator.CreateInstance(type);
            }

            var width = new Unit(Width.Value - ((Padding ?? 0) * 4), UnitType.Pixel);

            LookupBox = new LookupBox
            {
                ID             = "combo" + ID,
                DisplayField   = "RowName",
                ValueField     = "id",
                StoreID        = MembersStoreID,
                QueryCaching   = false,
                Hidden         = ReadOnly,
                ReadOnly       = ReadOnly,
                MultipleSelect = true,
            };
            LookupBox.InitializeListConfig(ComboboxViewListConfig);

            _containerLookupBox = new Container
            {
                ID = "container" + LookupBox.ID,
            };

            if (width.Value > 0)
            {
                LookupBox.Width = width;
            }
            else
            {
                _containerLookupBox.Layout = "Fit";
            }

            _containerLookupBox.Items.Add(LookupBox);

            GridPanel = new GridPanel
            {
                ID          = "grid" + ID,
                StoreID     = ValuesStoreID,
                HideHeaders = true,
                Height      = GridHeight ?? GetDefaultGridHeight(),
            };

            var containerGridPanel = new Container
            {
                ID = "container" + GridPanel.ID,
            };

            if (width.Value > 0)
            {
                GridPanel.Width = width;
            }
            else
            {
                containerGridPanel.Layout = "Fit";
            }

            containerGridPanel.Items.Add(GridPanel);

            GridPanel.View.Add(new GridView());
            GridPanel.SelectionModel.Add(new RowSelectionModel {
                Mode = SelectionMode.Multi
            });

            if (!string.IsNullOrEmpty(OnChangedValuesFn))
            {
                SetOnChangedValuesFn();
            }

            if (!string.IsNullOrEmpty(MembersStoreID))
            {
                LookupBox.Listeners.Change.Handler = string.Format(
                    @"
if (newValue != null && newValue != '') {{
    var newRow = #{{{3}}}.getById(newValue);
    if (newRow != null) {{
        var defaultData = {{RowName: newRow.data.RowName, Value: newRow.data.id}};
        var newRecord = #{{{0}}}.insert(0, defaultData);
        var field = #{{{1}}}; 
        var fn = field.{2}; 
        if (fn != null)
            fn(field.getValue());
        #{{{4}}}.setValue(null);
        field.fireEvent('change', field);
    }}
}}",
                    ValuesStoreID,
                    ID,
                    ScriptFunctionConstant.OnChangedValues,
                    MembersStoreID,
                    LookupBox.ID);
            }

            ViewCommand = GetViewCommand();
            GridPanel.ColumnModel.Add(ViewCommand);

            DeleteCommand = GetDeleteCommand();
            GridPanel.ColumnModel.Add(DeleteCommand);
            DataColumn = new Column
            {
                DataIndex = "RowName",
                Text      = Properties.Resources.SSelectedItems,
                Flex      = 1,
                Wrap      = true,
            };
            GridPanel.ColumnModel.Add(DataColumn);

            HiddenInsertedValues = new Hidden {
                ID = "hiddenInsertedValues" + ID
            };
            HiddenDeletedValues = new Hidden {
                ID = "hiddenDeletedValues" + ID
            };
            HiddenFilters = new Hidden {
                ID = ID + "Filters"
            };

            LabelErrorText = new Label
            {
                ID     = "labelErrorText" + ID,
                Text   = string.Format(Web.Controls.Properties.Resources.SRequiredFieldMessage, FieldLabel),
                Hidden = true,
                Icon   = Icon.Error
            };
            LabelErrorText.Style.Add("color", "red");

            BeforeElementText = new Label
            {
                ID     = "beforeElementText" + ID,
                Hidden = true
            };
            BeforeElementText.Style.Add("color", "blue");

            /*Items.Add(LookupBox);
            *  Items.Add(GridPanel);*/
            Items.Add(BeforeElementText);
            Items.Add(_containerLookupBox);
            Items.Add(containerGridPanel);

            Items.Add(HiddenInsertedValues);
            Items.Add(HiddenDeletedValues);
            Items.Add(HiddenFilters);
            Items.Add(LabelErrorText);

            var store = LookupBox.GetStore();

            store.Listeners.BeforeLoad.Handler +=
                string.Format(
                    @"store.getProxy().extraParams.parameters = GetExtNetLookupFilters(#{{{0}}});", HiddenFilters.ID);
            store.InitializeListConfig(ComboboxViewListConfig);

            LookupBox.LookupFiltersID = HiddenFilters.ID;
            dataSource = (EditableListDataSource)GridPanel.FindControl(GridPanel.GetStore().DataSourceID);
        }