public override void EndInit()
        {
            base.EndInit();
            ExtTextBlock block = new ExtTextBlock {
                Width = 100, Height = 20, Text = "Test Block"
            };
            ExtButton button = new ExtButton {
                Width = 100, Height = 20, Content = "ClickMe"
            };
            ExtLabel label = new ExtLabel {
                Width = 100, Height = 30, Content = "Test Label"
            };
            ExtTextBox txtBox = new ExtTextBox {
                Width = 100, Height = 20, Text = "Hi There"
            };
            Grid g = (Grid)BaseControl.FindChild(this, "gridMain");

            g.Children.Add(button);
            g.Children.Add(block);
            g.Children.Add(label);
            g.Children.Add(txtBox);
            Grid.SetRow(block, 0);
            Grid.SetRow(button, 1);
            Grid.SetRow(label, 2);
            Grid.SetRow(txtBox, 3);
            button.Click += button_Click;
        }
Ejemplo n.º 2
0
        private Control OnCreateTab(ExtendedControls.TabStrip t, int no)
        {
            UserControl uc = new UserControl();

            uc.BackColor     = Color.Cyan;
            uc.AutoScaleMode = AutoScaleMode.Font;

            DLabel lb = new DLabel();

            lb.Location = new Point(10, 10);
            lb.Size     = new Size(200, 24);
            lb.Text     = t.Name + " User Control " + (no + 0);

            ExtButton bb = new ExtButton();

            bb.Location = new Point(10, 40);
            bb.Size     = new Size(40, 40);
            bb.Text     = "BUT";
            bb.Name     = "UC " + no + " BUT";
            uc.Controls.Add(bb);

            uc.Name = "UC " + no + "!.";
            uc.Dock = DockStyle.Fill;
            uc.Controls.Add(lb);
            t.SetControlText("CT<" + uc.Name + ">");

            Theme.Current.ApplyStd(uc);
            return(uc);
        }
Ejemplo n.º 3
0
        // Populate a 'Canvas' control with UI objects using colors provided via the Constructor.
        // The caller can then place the 'Canvas' where they want in their UI.
        private void CreateColorSchemeSample(int inColorSchemeNumber)
        {
            // Create a button for which the user can click to choose the color scheme.
            // Create the button first because it covers the entire Canvas, so the Canvas will use its height + width.

            // The ExtButton type offers the extra 'mouseover color' property, so even that is part of the
            // chosen color scheme.
            try
            {
                aButton       = new ExtButton();
                aButton.Style = extButtonStyle;

                // The background is transparent so the user sees the following colored UI controls.
                aButton.Background = new SolidColorBrush(Colors.Transparent);

                aButton.Margin                     = new Thickness(0, 0, 0, 0);
                aButton.BorderThickness            = new Thickness(5, 5, 5, 5);
                aButton.Height                     = 200;
                aButton.Width                      = 200;
                aButton.Cursor                     = Cursors.Hand;
                aButton.HorizontalContentAlignment = HorizontalAlignment.Center;
                aButton.ToolTip                    = mToolTip;
                aButton.MouseOverBackground        = tempColorScheme.MouseOverBrush;

                aCanvas            = new Canvas();
                aCanvas.Margin     = new Thickness(10, 10, 10, 10);
                aCanvas.Height     = aButton.Height - 5;
                aCanvas.Width      = aButton.Width - 5;
                aCanvas.Background = tempColorScheme.BackgroundSolidBrush1;

                // Simulate a main menustrip
                aGrid            = new Grid();
                aGrid.Background = tempColorScheme.BackgroundSolidBrush2;
                aGrid.Margin     = new Thickness(5, 5, 0, 0);
                aGrid.MinHeight  = 30;
                aGrid.Width      = 190;

                // Simulate a toolStrip for a main menu
                aGrid.Children.Add(ToolStripForBackground1AndForeground1());

                aCanvas.Children.Add(LabelForBackgroundLinearBrush1());
                aCanvas.Children.Add(TextBoxForBackground2AndForeground2());
                aCanvas.Children.Add(LabelForBackgroundLinearyBrush2());

                // Simulate buttons to use Radial Brushes
                aCanvas.Children.Add(ButtonForBackgroundRadial1());
                aCanvas.Children.Add(ButtonForBackgroundRadial2());

                // Simulate button for solid brushes Background2 and Foreground2
                aCanvas.Children.Add(ButtonForBackground2AndForeGround2());

                aCanvas.Children.Add(aGrid);
                aCanvas.Children.Add(aButton);
            }
            catch (Exception ex)
            {
                // Log the error
                ErrorHandler.Log(ex);
            }
        }
Ejemplo n.º 4
0
        private void extButton21_Click(object sender, EventArgs e)
        {
            ConfigurableForm cfg = new ExtendedControls.ConfigurableForm();

            cfg.AllowSpaceForScrollBar   = false;
            cfg.RightMargin              = cfg.BottomMargin = 0;
            cfg.ForceNoWindowsBorder     = true;
            cfg.AllowSpaceForCloseButton = true;
            cfg.BorderMargin             = 0;

            ExtButton wikibutton = new ExtButton();

            wikibutton.Image = Properties.Resources.CursorToTop;
            cfg.Add(new ConfigurableForm.Entry(wikibutton, "Wiki", null, new Point(0, 0), new Size(24, 24), null));

            ExtButton videobutton = new ExtButton();

            videobutton.Image = Properties.Resources.CursorToTop;
            cfg.Add(new ConfigurableForm.Entry(videobutton, "Video", null, new Point(24, 0), new Size(24, 24), null));

            cfg.Trigger += (string logicalname, string ctrlname, object callertag) =>
            {
                if (ctrlname == "Close")
                {
                    cfg.ReturnResult(DialogResult.Cancel);
                }
                else if (ctrlname == "Wiki")
                {
                    cfg.ReturnResult(DialogResult.OK);
                }
                else if (ctrlname == "Video")
                {
                    cfg.ReturnResult(DialogResult.Yes);
                }
            };

            Theme.Current.WindowsFrame = false;
            Theme.Current.FontSize     = sender is float?(float)sender : 8.5f;

            DialogResult res = cfg.ShowDialog(this, new Point(500, 500), this.Icon, "", closeicon: true);
        }
Ejemplo n.º 5
0
        private void ShowDividers(bool show)
        {
            foreach (ExtButton p in dividers)
            {
                p.Visible = false;
            }

            //System.Diagnostics.Debug.WriteLine("Dividers " + show);
            if (show)
            {
                dividercapture = -1;

                for (int i = 1; i < columnpos.Count; i++)              // bring up the number of dividers needed
                {
                    ExtButton b = dividers[i - 1];
                    b.Location           = new Point(scanpostextoffset.X + columnpos[i] - b.Width / 2, 0);
                    b.ButtonColorScaling = 1.0F;
                    if (b.FlatStyle == FlatStyle.System)            // System can't do bitmaps.. we need standard.
                    {
                        b.FlatStyle = FlatStyle.Standard;
                    }
                    else if (b.FlatStyle == FlatStyle.Popup)        // if in Popup (ours) we can adjust the look further.
                    {
                        b.FlatAppearance.BorderColor = dividers[i - 1].BackColor;
                    }
                    b.Visible = true;
                }

                dividercheck.Start();
            }
            else
            {
                dividercapture = -2;
                dividercheck.Stop();
            }
        }
Ejemplo n.º 6
0
        // do videos
        // use file in folder if present, download folder..

        public static void Help(Form parent, Point pos, string name)
        {
            JToken helptouse = defaulthelp;

            string helpfile = Path.Combine(EDDOptions.Instance.HelpDirectory(), "help.json");

            if (File.Exists(helpfile))
            {
                string t        = BaseUtils.FileHelpers.TryReadAllTextFromFile(helpfile);
                JToken filejson = t != null?JToken.Parse(t) : null;

                if (filejson != null)
                {
                    Version intv  = new Version(helptouse["Version"].Str("0.0.0.0"));
                    Version filev = new Version(filejson["Version"].Str("0.0.0.0"));

                    if (filev >= intv)
                    {
                        helptouse = filejson;
                    }
                }
            }

            //System.IO.File.WriteAllText(@"c:\code\help.json",helptouse.ToString(true));
            //System.Diagnostics.Debug.WriteLine("Help on " + name);

            string wiki  = Properties.Resources.URLProjectWiki;     // default..
            string video = Properties.Resources.URLProjectVideos;

            JArray panels = helptouse["Panels"].Array();                                                                    // may be null if there is trouble

            JToken obj = panels?.Where(x => x.Object()["panel"].ValueEquals(name)).Select(x => x).FirstOrDefault() ?? null; // allow for panels to be null

            if (obj != null)
            {
                wiki  = obj["wiki"].StrNull();
                video = obj["video"].StrNull();

                if (wiki != null && wiki.StartsWith("/"))
                {
                    wiki = Properties.Resources.URLProjectWiki + wiki;
                }

                if (video != null && video.StartsWith("/"))
                {
                    video = Properties.Resources.URLProjectVideosRoot + video;
                }

                //System.Diagnostics.Debug.WriteLine("For {0} {1} {2}", name, wiki, video);
            }

            if (wiki.HasChars() && video.HasChars())
            {
                ConfigurableForm cfg = new ExtendedControls.ConfigurableForm();
                cfg.AllowSpaceForScrollBar   = false;
                cfg.RightMargin              = cfg.BottomMargin = 0;
                cfg.ForceNoWindowsBorder     = true;
                cfg.AllowSpaceForCloseButton = true;
                cfg.BorderMargin             = 0;
                cfg.ExtraMarginRightBottom   = new Size(0, 0);

                ExtButton wikibutton = new ExtButton();
                wikibutton.Image = global::EDDiscovery.Icons.Controls.Help_Wiki;
                cfg.Add(new ConfigurableForm.Entry(wikibutton, "Wiki", null, new Point(0, 0), new Size(24, 24), null));
                ExtButton videobutton = new ExtButton();
                videobutton.Image = global::EDDiscovery.Icons.Controls.Help_Video;
                cfg.Add(new ConfigurableForm.Entry(videobutton, "Video", null, new Point(26, 0), new Size(24, 24), null));

                cfg.Trigger += (string logicalname, string ctrlname, object callertag) =>
                {
                    if (ctrlname == "Close")
                    {
                        cfg.ReturnResult(DialogResult.Cancel);
                    }
                    else if (ctrlname == "Wiki")
                    {
                        cfg.ReturnResult(DialogResult.OK);
                    }
                    else if (ctrlname == "Video")
                    {
                        cfg.ReturnResult(DialogResult.Yes);
                    }
                };

                DialogResult res = cfg.ShowDialog(parent, pos, parent.Icon, "", closeicon: true);
                if (res == DialogResult.OK)
                {
                    BaseUtils.BrowserInfo.LaunchBrowser(wiki);
                }
                else if (res == DialogResult.Yes)
                {
                    BaseUtils.BrowserInfo.LaunchBrowser(video);
                }
            }
            else if (wiki.HasChars())
            {
                BaseUtils.BrowserInfo.LaunchBrowser(wiki);
            }
            else if (video.HasChars())
            {
                BaseUtils.BrowserInfo.LaunchBrowser(video);
            }
            else
            {
                MessageBox.Show("No help for " + name);
            }
        }
Ejemplo n.º 7
0
        protected void menu_ItemClicked(object sender, EventArgs e)
        {
            SlidingMenuItem item = sender as SlidingMenuItem;
            if (item == null)
            {
                return;
            }
            if (item.Xtra.IndexOf("trigger") == 0)
            {
                string eventToRaise = item.Xtra.Substring(7);
                string wholeEventToRaise = eventToRaise;
                if (eventToRaise.Contains("-__params"))
                {
                    eventToRaise = eventToRaise.Substring(0, eventToRaise.IndexOf("-__params"));
                }

                // Raising the MenuClicked event...
                Node node = new Node();
                node["MenuEventName"].Value = eventToRaise;
                node["MenuText"].Value = Selector.SelectFirst<ExtButton>(item).Text;
                if (wholeEventToRaise.Contains("-__params"))
                {
                    node["Params"].Value = wholeEventToRaise.Split(new[] { "-__params" }, StringSplitOptions.RemoveEmptyEntries)[1];
                }
                ActiveEvents.Instance.RaiseActiveEvent(
                    this,
                    "MenuItemClicked",
                    node);

                // Raising the event the Node defines in the "Value" property
                node = new Node();
                if (wholeEventToRaise.Contains("-__params"))
                {
                    node["Params"].Value = wholeEventToRaise.Split(new[] { "-__params" }, StringSplitOptions.RemoveEmptyEntries)[1];
                }
                ActiveEvents.Instance.RaiseActiveEvent(
                    this, 
                    eventToRaise,
                    node);
            }
            ExtButton btn = Selector.SelectFirst<ExtButton>(item);
            if (btn == null)
                return;
            if (Settings.Instance["UseFlatMenu"] == "True")
                return;
            btn.CssClass = "button button-selected menuBtn";
            if (PreviouslySelectedButton != null && PreviouslySelectedButton.ID != btn.ID)
            {
                PreviouslySelectedButton.CssClass = "mumbo";
                PreviouslySelectedButton.CssClass = "button menuBtn";
            }
            PreviouslySelectedButton = btn;
        }
Ejemplo n.º 8
0
        private void CreateSingleMenuItem(
            Node node,
            Control parent)
        {
            if (node.Name == "Params")
                return;
            SlidingMenuItem item = new SlidingMenuItem {ID = "node" + node.DNA.Replace("-", "x")};

            if (Settings.Instance["UseFlatMenu"] == "True")
            {
                item.CssClass = "sliding-item menuFlat";
            }

            if (node.Get<string>().IndexOf("url:") == 0)
            {
                item.NoClick = true;
                HtmlGenericControl btn = new HtmlGenericControl("span");
                btn.Attributes.Add("class", Settings.Instance["UseFlatMenu"] == "True" ?
                    "buttonFlat menuBtn" :
                    "button menuBtn");

                HtmlGenericControl right = new HtmlGenericControl("span");
                right.Attributes.Add("class", "bRight");
                btn.Controls.Add(right);

                HtmlGenericControl left = new HtmlGenericControl("span");
                left.Attributes.Add("class", "bLeft");
                right.Controls.Add(left);

                HtmlGenericControl center = new HtmlGenericControl("span");
                center.Attributes.Add("class", "bCenter");
                left.Controls.Add(center);

                HtmlGenericControl cont = new HtmlGenericControl("span");
                center.Controls.Add(cont);

                HtmlAnchor a = new HtmlAnchor
                {
                    HRef = node.Get<string>().Replace("url:~/", ApplicationRoot.Root),
                    InnerHtml = Language.Instance[node.Name]
                };
                a.Attributes.Add("class", "menuLink");
                center.Controls.Add(a);

                item.Content.Controls.Add(btn);
                item.CssClass += " linkButton";

                if (node.Count > 0)
                {
                    SlidingMenuLevel l = new SlidingMenuLevel
                    {
                        Caption = a.InnerHtml,
                        ID = "ch" + node.DNA.Replace("-", "x")
                    };
                    item.Controls.Add(l);
                    foreach (Node idx in node)
                    {
                        CreateSingleMenuItem(idx, l);
                    }
                }
            }
            else
            {
                // Creating a button inside to make the menu appear more beautiful...
                ExtButton btn = new ExtButton {ID = "b" + item.ID};
                string btnText = Language.Instance[node.Name];
                btn.Text = btnText;
                btn.CssClass = Settings.Instance["UseFlatMenu"] == "True" ? 
                    "buttonFlat menuBtn" : 
                    "button menuBtn";
                item.Content.Controls.Add(btn);

                bool hasTrigger = false;

                if (node.Count > 0)
                {
                    // Checking to see if the only child node is the "params node"...
                    if (!(node.Count == 1 && node["Params"].Value != null))
                    {
                        SlidingMenuLevel l = new SlidingMenuLevel
                        {
                            Caption = btnText,
                            ID = "ch" + node.DNA.Replace("-", "x")
                        };
                        item.Controls.Add(l);
                        l.Xtra = node.DNA;
                        item.Xtra = node.DNA;
                        foreach (Node idx in node)
                        {
                            CreateSingleMenuItem(idx, l);
                        }
                    }
                    else
                        hasTrigger = true;
                }
                else
                {
                    hasTrigger = true;
                }
                if (hasTrigger)
                {
                    if (node["Params"].Value != null)
                    {
                        item.Xtra = "trigger" +
                            node.Value +
                            "-__params" +
                            node["Params"].Value;
                    }
                    else
                    {
                        item.Xtra = "trigger" + node.Value;
                    }
                }
                
            }
            parent.Controls.Add(item);
        }
Ejemplo n.º 9
0
 private void VoteForComment(ExtButton btn, int value)
 {
     int commentId = int.Parse(btn.Xtra);
     Node node = new Node();
     node["CommentID"].Value = commentId;
     node["Score"].Value = value;
     ActiveEvents.Instance.RaiseActiveEvent(
         this,
         "ArticleDislikeComment",
         node);
     if (node["Refresh"].Get<bool>())
     {
         Label lbl = Selector.SelectFirst<Label>(btn.Parent.Parent.Parent.Parent,
             delegate(System.Web.UI.Control idx)
             {
                 return idx.ID == "lscr" + commentId;
             });
         int commentToShow = int.Parse(PreviouslyShownComment.Replace(pnlWrp.ID, ""));
         PreviouslyShownComment = null;
         root.Controls.Clear();
         InitializeForum(commentToShow);
         root.ReRender();
         System.Web.UI.Control ctrl = Selector.FindControl<System.Web.UI.Control>(root, PreviouslyShownComment);
         new EffectRollUp(ctrl, 100)
             .ChainThese(new EffectRollDown(ctrl, 400))
             .Render();
     }
 }
Ejemplo n.º 10
0
        private void CreateLevel(TreeNodes level, LazyList<ForumPost> list, int commentToShow, int curLevel)
        {
            list.Sort(
                delegate(ForumPost left, ForumPost right)
                {
                    if (left.Score == right.Score)
                        return left.When.CompareTo(right.When);
                    return right.Score.CompareTo(left.Score);
                });
            curLevel += 1;
            foreach (ForumPost idx in list)
            {
                _commentCount += 1;
                TreeNode n = new TreeNode();
                n.ID = "pst" + idx.ID;
                if (curLevel > 11)
                {
                    n.Load +=
                        delegate(object sender, EventArgs e)
                        {
                            TreeNode n1 = sender as TreeNode;
                            if (!n1.CssClass.Contains("tree-more"))
                                n1.CssClass += " tree-more";
                        };
                }

                Label l = new Label();
                l.ID = "hdr" + idx.ID;
                l.Text = idx.Header;
                l.CssClass = "headerTxtComment";
                l.Style[Styles.width] = (350 - (Math.Min(curLevel, 11) * 16)) + "px";
                n.Controls.Add(l);

                Label lblDate = new Label();
                lblDate.ID = "ldta" + idx.ID;
                lblDate.CssClass = "dateLbl";
                DateTime dateTmp = idx.When;

                // Intentionally deferring Text property to get an *UPDATED* text value of time...!
                lblDate.Load +=
                    delegate(object sender, EventArgs e)
                    {
                        (sender as Label).Text = DateFormatter.FormatDate(dateTmp);
                    };
                n.Controls.Add(lblDate);

                Label lblUser = new Label();
                lblUser.ID = "lusr" + idx.ID;
                lblUser.CssClass = "userLbl";
                if (idx.IsRegisteredPosting)
                {
                    lblUser.Text = string.Format("<a href=\"authors/{0}{2}\">{1}</a>",
                        idx.GetNameOfPoster().Replace(".", "--"),
                        idx.GetNameOfPoster(),
                        ConfigurationManager.AppSettings["DefaultPageExtension"]);
                }
                else
                {
                    lblUser.Text = idx.GetNameOfPoster();
                }
                n.Controls.Add(lblUser);

                Label lblScore = new Label();
                lblScore.ID = "lscr" + idx.ID;
                lblScore.CssClass = "scoreLbl";
                lblScore.Text = FormatScore(idx.Score);
                n.Controls.Add(lblScore);

                Panel pnl = new Panel();
                pnl.ID = "pnlWrp" + idx.ID;
                pnl.CssClass = "bodyOfCommentWrp";

                Panel pnlInner = new Panel();
                pnlInner.ID = "bdy" + idx.ID;
                if (idx.ID == commentToShow)
                {
                    pnl.Xtra = "visible";
                    PreviouslyShownComment = pnl.ID;
                }
                else
                    pnl.Style[Styles.display] = "none";
                pnlInner.CssClass = "bodyOfComment";
                pnlInner.Style[Styles.left] = ((Math.Min(curLevel, 11) * 16)).ToString() + "px";
                pnlInner.Style[Styles.marginRight] = (25 + (Math.Min(curLevel, 11) * 16)).ToString() + "px";
                Label ltext = new Label();
                ltext.ID = "lTxt" + idx.ID;
                string bodyStr = FormatComment(idx);
                bool hasFound = true;
                while (hasFound)
                {
                    if (bodyStr.Contains("\n\n"))
                    {
                        bodyStr = bodyStr.Replace("\n\n", "\n");
                    }
                    else
                        hasFound = false;
                }
                string bodyStrFormatted = "<p";
                bool hasOpened = false;
                bool isFirst = true;
                foreach (char idxChar in bodyStr)
                {
                    if (hasOpened || isFirst)
                    {
                        isFirst = false;
                        if (idxChar == ':')
                            bodyStrFormatted += " class=\"quote\">";
                        else
                            bodyStrFormatted += " class=\"no-quote\">";
                        hasOpened = false;
                        bodyStrFormatted += idxChar;
                    }
                    else if (idxChar == '\n')
                    {
                        bodyStrFormatted += "</p><p";
                        hasOpened = true;
                    }
                    else
                    {
                        bodyStrFormatted += idxChar;
                    }
                }
                bodyStrFormatted += "</p>";
                ltext.Text = bodyStrFormatted;
                pnlInner.Controls.Add(ltext);
                pnl.Controls.Add(pnlInner);
                n.Controls.Add(pnl);

                // Social parts + reply button
                Panel pnlSocial = new Panel();
                pnlSocial.ID = "soc" + idx.ID;
                pnlSocial.CssClass = "downRight";

                if (AllowVoting)
                {
                    // Like button
                    ExtButton like = new ExtButton();
                    like.ID = "lik" + idx.ID;
                    like.CssClass = "button";
                    like.Xtra = idx.ID.ToString();
                    like.Click += like_Click;
                    like.Text = Language.Instance["Like", null, "Like"];
                    pnlSocial.Controls.Add(like);

                    // Dislike button
                    ExtButton dislike = new ExtButton();
                    dislike.ID = "dis" + idx.ID;
                    dislike.CssClass = "button";
                    dislike.Xtra = idx.ID.ToString();
                    dislike.Click += dislike_Click;
                    dislike.Text = Language.Instance["Dislike", null, "Dislike"];
                    pnlSocial.Controls.Add(dislike);
                }

                // Reply button
                ExtButton replyButton = new ExtButton();
                replyButton.ID = "btn" + idx.ID;
                replyButton.CssClass = "button";
                replyButton.Xtra = idx.ID.ToString();
                replyButton.Click += replyButton_Clicked;
                replyButton.Text = Language.Instance["Reply", null, "Reply"];
                pnlSocial.Controls.Add(replyButton);

                if (!string.IsNullOrEmpty(Users.LoggedInUserName))
                {
                    User user = User.SelectFirst(Criteria.Eq("Username", Users.LoggedInUserName));
                    if (user.InRole("Administrator"))
                    {
                        // Delete button
                        ExtButton deleteButton = new ExtButton();
                        deleteButton.ID = "delBtn" + idx.ID;
                        deleteButton.CssClass = "button";
                        deleteButton.Xtra = idx.ID.ToString();
                        deleteButton.Click += deleteButton_Clicked;
                        deleteButton.Text = Language.Instance["Delete", null, "Delete"];
                        pnlSocial.Controls.Add(deleteButton);
                    }
                }

                pnlInner.Controls.Add(pnlSocial);

                level.Controls.Add(n);
                if (idx.Replies.Count > 0)
                {
                    if (curLevel <= 10)
                    {
                        TreeNodes children = new TreeNodes();
                        children.Expanded = true;
                        children.ID = "chl" + idx.ID;
                        CreateLevel(children, idx.Replies, commentToShow, curLevel);
                        n.Controls.Add(children);
                    }
                    else
                    {
                        // We do NOT indent more than 10 levels...!
                        // After 10 levels, we get a funny folder icon to indicate 
                        // that we're at more than 10 levels...!
                        CreateLevel(level, idx.Replies, commentToShow, curLevel);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private void CreateHeaders(Control table)
        {
            Label row = new Label {Tag = "tr", ID = "head"};
            foreach (Node idx in DataSource["Columns"])
            {
                Label cell = new Label
                {
                    Tag = "td",
                    ID = idx["Caption"].Get<string>().Replace("|", "").Replace(" ", "")
                };

                ExtButton btn = new ExtButton
                {
                    ID = "b" + idx["Caption"].Get<string>().Replace("|", "").Replace(" ", ""),
                    Text = idx["Caption"].Get<string>(),
                    Xtra = idx.Name
                };
                if (SortColumn == btn.Xtra)
                {
                    btn.CssClass = "button headerButton clicked";
                }
                else if (SortColumn == "-" + btn.Xtra)
                {
                    btn.CssClass = "button headerButton clicked-backwards";
                }
                else
                {
                    btn.CssClass = "button headerButton";
                }
                btn.Click +=
                    delegate(object sender, EventArgs e)
                    {
                        ExtButton bt = sender as ExtButton;
                        if (bt != null)
                        {
                            bool backwards = SortColumn == bt.Xtra;
                            SortColumn = backwards ? "-" + bt.Xtra : bt.Xtra;
                        }
                        DataBindGrid();
                        _lstWrappers.ReRender();
                    };
                cell.Controls.Add(btn);

                cell.Style["width"] = (100 / DataSource["Columns"].Count) + "%";
                row.Controls.Add(cell);
            }
            table.Controls.Add(row);
        }