Esempio n. 1
0
        public void HeaderClick(object sender, EventArgs e)
        {
            RepeaterHeaderLink lb = (RepeaterHeaderLink)sender;

            if (SortColumn == lb.DataCol)
            {
                if (SortDirection.ToLower() != "asc")
                {
                    SortDirection = "asc";
                }
                else
                {
                    SortDirection = "desc";
                }
            }
            else
            {
                SortDirection = "asc";
            }

            SortColumn = lb.DataCol;

            if (this.SortColumn != "")
            {
                string sortStr = this.SortColumn + " " + this.SortDirection.ToUpper();
                DataSource.DefaultView.Sort = sortStr;
            }

            DataBind();
        }
Esempio n. 2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            base.CreateChildControls();
            if (this.DataCol != null)
            {
                RepeaterHeaderLink lb = new RepeaterHeaderLink();
                if (resource != null)
                {
                    ResourceManager rm = (ResourceManager)HttpContext.Current.Application["RM"];
                    lb.Text = rm.GetString(resource);
                }
                else
                {
                    lb.Text = this.InnerHtml;
                }
                lb.CssClass = "HeaderLink";
                lb.ID       = "Headerlink" + this.ID;
                lb.DataCol  = this.DataCol;

                this.linkText = lb.Text;

                this.InnerHtml = "";

                HtmlTableCell td = new HtmlTableCell("TD");
                td.Attributes.Add("class", CssClass);
                td.Width = this.width;
                this.Controls.Add(td);
                td.Controls.Add(lb);
                lb.Click += new EventHandler(((TustenaRepeater)this.Parent.Parent.Parent).HeaderClick);
            }
            else
            {
                Label lbl = new Label();
                lbl.Text     = this.InnerHtml;
                lbl.CssClass = "HeaderText";
                lbl.ID       = "HeaderText" + this.ID;

                this.InnerHtml = "";

                HtmlTableCell td = new HtmlTableCell("TD");
                td.Attributes.Add("class", CssClass);
                td.Width = this.width;
                this.Controls.Add(td);
                td.Controls.Add(lbl);
            }
        }