Beispiel #1
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            _ctrlWrappers = new Panel {ID = "wrp", CssClass = "controlWrappers"};
            _ctrlWrappers.Style[Styles.opacity] = "0.3";
            Controls.Add(_ctrlWrappers);

            BehaviorUnveiler unveiler = new BehaviorUnveiler {ID = "unveiler"};
            _ctrlWrappers.Controls.Add(unveiler);

            _filterWrapper = new Panel {ID = "fltW", DefaultWidget = "fltB"};

            _filter = new TextBox {ID = "flt", CssClass = "filter"};

            _fltBtn = new Button {ID = "fltB"};
            _fltBtn.Style[Styles.marginLeft] = "-1000px";
            _fltBtn.Click += 
                delegate
                {
                    // Making sure we select all "filter text" to mak it easy to "re-filter"...
                    _filter.Focus();
                    _filter.Select();

                    // Checking for dead keys...
                    if (OldFilter != _filter.Text)
                    {
                        CurrentPage = 0;
                        DataBindGrid();
                        _lstWrappers.ReRender();
                        _lstWrappers.Style[Styles.display] = "none";
                        new EffectFadeIn(_lstWrappers, 200)
                            .Render();
                        OldFilter = _filter.Text;
                    }
                };
            _filterWrapper.Controls.Add(_filter);
            _filterWrapper.Controls.Add(_fltBtn);
            _ctrlWrappers.Controls.Add(_filterWrapper);

            _previous = new LinkButton {ID = "prev", Text = " ", CssClass = "previous"};
            _previous.Text = "<<";
            _previous.Click +=
                delegate
                {
                    if (CurrentPage != 0)
                    {
                        CurrentPage -= 1;
                        DataBindGrid();
                        _lstWrappers.ReRender();
                        new EffectRollUp(_lstWrappers, 200)
                            .ChainThese(
                                new EffectFadeIn(_lstWrappers, 200))
                            .Render();
                    }
                };
            _ctrlWrappers.Controls.Add(_previous);

            _count = new Label {ID = "cnt", CssClass = "count"};
            _ctrlWrappers.Controls.Add(_count);

            _next = new LinkButton {ID = "next", Text = " ", CssClass = "next"};
            _next.Text = ">>";
            _next.Click +=
                delegate
                {
                    if ((CurrentPage + 1) * PageSize < DataSource["Rows"].Count)
                    {
                        CurrentPage += 1;
                        DataBindGrid();
                        _lstWrappers.ReRender();
                        new EffectRollUp(_lstWrappers, 200)
                            .ChainThese(
                                new EffectFadeIn(_lstWrappers, 200))
                            .Render();
                    }
                };
            _ctrlWrappers.Controls.Add(_next);

            _lstWrappers = new Panel {ID = "lstWrp", CssClass = "gridWrapper"};
            Controls.Add(_lstWrappers);
        }