Exemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            LinkButton dummyLink = new LinkButton();

            dummyLink.ID = "dummyLink";
            this.Controls.Add(dummyLink);
            UpdatePanelDynamic linkUpdatePanel = new UpdatePanelDynamic();

            this.Controls.Add(linkUpdatePanel);
            _link      = new LinkButton();
            _link.ID   = "selectorLauncher";
            _link.Text = "";
            linkUpdatePanel.ContentTemplateContainer.Controls.Add(_link);
            this.Link.Click    += new EventHandler(Link_Click);
            _container          = new Panel();
            _container.ID       = "selectorContainer";
            _container.CssClass = "selector_modalPopup";
            _container.Style.Add("display", "none");
            _searchPanel          = new Panel();
            _searchPanel.ID       = "searchPanel";
            _searchPanel.CssClass = "selector_searchpanel";
            _container.Controls.Add(_searchPanel);
            _buttonsPanel          = new Panel();
            _buttonsPanel.ID       = "buttonsPanel";
            _buttonsPanel.CssClass = "selector_buttonspanel";
            _container.Controls.Add(_buttonsPanel);
            this.UpdatePanel                   = new UpdatePanelDynamic();
            this.UpdatePanel.ID                = "updatePanel";
            this.resultsSelectedIndexHidden    = new HiddenField();
            this.resultsSelectedIndexHidden.ID = "resultsSelectedIndexHidden";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(this.resultsSelectedIndexHidden);
            visibilityHidden    = new HiddenField();
            visibilityHidden.ID = "visibilityHidden";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(visibilityHidden);
            _titleLabel          = new Label();
            _titleLabel.CssClass = "selector_title";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(_titleLabel);
            _criteriaDataSource    = new DataTableDataSource();
            _criteriaDataSource.ID = "criteriaDataSource";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(_criteriaDataSource);
            Panel criteriaPanel = new Panel();

            criteriaPanel.CssClass = "selector_criteriaPanel";
            _criteria             = new FormView();
            _criteria.ID          = "Criteria";
            _criteria.CssClass    = "selector_criteria";
            _criteria.DefaultMode = FormViewMode.Edit;
            criteriaPanel.Controls.Add(_criteria);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(criteriaPanel);
            Panel searchButtonPanel = new Panel();

            searchButtonPanel.CssClass = "selector_searchButtonPanel";
            _searchButton        = new OneClickButton();
            _searchButton.ID     = "searchButton";
            _searchButton.Text   = _searchText;
            _searchButton.Click += new EventHandler(this.searchButton_Click);
            searchButtonPanel.Controls.Add(_searchButton);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(searchButtonPanel);
            Panel resultsContainer = new Panel();

            resultsContainer.ID       = "resultsContainer";
            resultsContainer.CssClass = "selector_results";
            _results    = new DataGridView();
            _results.ID = "Results";
            _results.AutoGenerateSelectButton = true;

            if (null != _selectorSource)
            {
                _results.DataSource = _selectorSource;
            }

            resultsContainer.Controls.Add(_results);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(resultsContainer);
            _searchPanel.Controls.Add(this.UpdatePanel);
            _okButton      = new Button();
            _okButton.ID   = "okButton";
            _okButton.Text = _okText;
            _buttonsPanel.Controls.Add(_okButton);
            _cancelButton      = new Button();
            _cancelButton.ID   = "cancelButton";
            _cancelButton.Text = _cancelText;
            _buttonsPanel.Controls.Add(_cancelButton);
            this.Controls.Add(_container);
            _container.DefaultButton                    = "searchButton";
            this.PopupExtender                          = new ModalPopupExtender();
            this.PopupExtender.ID                       = "popupExtender";
            this.PopupExtender.TargetControlID          = "dummyLink";
            this.PopupExtender.PopupControlID           = "selectorContainer";
            this.PopupExtender.BackgroundCssClass       = "selector_modalBackground";
            this.PopupExtender.OkControlID              = "okButton";
            this.PopupExtender.CancelControlID          = "cancelButton";
            this.PopupExtender.DropShadow               = true;
            this.PopupExtender.PopupDragHandleControlID = "selectorContainer";
            this.Controls.Add(this.PopupExtender);

            if (this.shouldShow)
            {
                this.DoShow();
            }
            if (this.shouldHide)
            {
                this.DoHide();
            }

            base.OnInit(e);
            this.Results.SelectedIndexChanged += new EventHandler(this.Results_SelectedIndexChanged);
        }
Exemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            LinkButton dummyLink = new LinkButton();
            dummyLink.ID = "dummyLink";
            this.Controls.Add(dummyLink);
            UpdatePanelDynamic linkUpdatePanel = new UpdatePanelDynamic();
            this.Controls.Add(linkUpdatePanel);
            _link = new LinkButton();
            _link.ID = "selectorLauncher";
            _link.Text = "";
            linkUpdatePanel.ContentTemplateContainer.Controls.Add(_link);
            this.Link.Click += new EventHandler(Link_Click);
            _container = new Panel();
            _container.ID = "selectorContainer";
            _container.CssClass = "selector_modalPopup";
            _container.Style.Add("display", "none");
            _searchPanel = new Panel();
            _searchPanel.ID = "searchPanel";
            _searchPanel.CssClass = "selector_searchpanel";
            _container.Controls.Add(_searchPanel);
            _buttonsPanel = new Panel();
            _buttonsPanel.ID = "buttonsPanel";
            _buttonsPanel.CssClass = "selector_buttonspanel";
            _container.Controls.Add(_buttonsPanel);
            this.UpdatePanel = new UpdatePanelDynamic();
            this.UpdatePanel.ID = "updatePanel";
            this.resultsSelectedIndexHidden = new HiddenField();
            this.resultsSelectedIndexHidden.ID = "resultsSelectedIndexHidden";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(this.resultsSelectedIndexHidden);
            visibilityHidden = new HiddenField();
            visibilityHidden.ID = "visibilityHidden";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(visibilityHidden);
            _titleLabel = new Label();
            _titleLabel.CssClass = "selector_title";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(_titleLabel);
            _criteriaDataSource = new DataTableDataSource();
            _criteriaDataSource.ID = "criteriaDataSource";
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(_criteriaDataSource);
            Panel criteriaPanel = new Panel();
            criteriaPanel.CssClass = "selector_criteriaPanel";
            _criteria = new FormView();
            _criteria.ID = "Criteria";
            _criteria.CssClass = "selector_criteria";
            _criteria.DefaultMode = FormViewMode.Edit;
            criteriaPanel.Controls.Add(_criteria);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(criteriaPanel);
            Panel searchButtonPanel = new Panel();
            searchButtonPanel.CssClass = "selector_searchButtonPanel";
            _searchButton = new OneClickButton();
            _searchButton.ID = "searchButton";
            _searchButton.Text = _searchText;
            _searchButton.Click += new EventHandler(this.searchButton_Click);
            searchButtonPanel.Controls.Add(_searchButton);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(searchButtonPanel);
            Panel resultsContainer = new Panel();
            resultsContainer.ID = "resultsContainer";
            resultsContainer.CssClass = "selector_results";
            _results = new DataGridView();
            _results.ID = "Results";
            _results.AutoGenerateSelectButton = true;

            if (null != _selectorSource)
                _results.DataSource = _selectorSource;

            resultsContainer.Controls.Add(_results);
            this.UpdatePanel.ContentTemplateContainer.Controls.Add(resultsContainer);
            _searchPanel.Controls.Add(this.UpdatePanel);
            _okButton = new Button();
            _okButton.ID = "okButton";
            _okButton.Text = _okText;
            _buttonsPanel.Controls.Add(_okButton);
            _cancelButton = new Button();
            _cancelButton.ID = "cancelButton";
            _cancelButton.Text = _cancelText;
            _buttonsPanel.Controls.Add(_cancelButton);
            this.Controls.Add(_container);
            _container.DefaultButton = "searchButton";
            this.PopupExtender = new ModalPopupExtender();
            this.PopupExtender.ID = "popupExtender";
            this.PopupExtender.TargetControlID = "dummyLink";
            this.PopupExtender.PopupControlID = "selectorContainer";
            this.PopupExtender.BackgroundCssClass = "selector_modalBackground";
            this.PopupExtender.OkControlID = "okButton";
            this.PopupExtender.CancelControlID = "cancelButton";
            this.PopupExtender.DropShadow = true;
            this.PopupExtender.PopupDragHandleControlID = "selectorContainer";
            this.Controls.Add(this.PopupExtender);

            if (this.shouldShow)
                this.DoShow();
            if (this.shouldHide)
                this.DoHide();

            base.OnInit(e);
            this.Results.SelectedIndexChanged += new EventHandler(this.Results_SelectedIndexChanged);
        }