Exemplo n.º 1
0
        protected void gvCard_Sorting(object sender, GridViewSortEventArgs e)
        {
            lock (Database.lockObjectDB)
            {
                int i = FuncClass.GetSortIndex(e.SortExpression, gvCard);

                if (lbSortIndex.Text != "")
                {
                    int ind = Convert.ToInt32(lbSortIndex.Text);
                    gvCard.Columns[ind].HeaderText            = gvCard.Columns[ind].HeaderText.Replace("^", "");
                    gvCard.Columns[ind].HeaderStyle.BackColor = System.Drawing.Color.FromArgb(0, 102, 153);
                }

                lbSortIndex.Text = i.ToString();

                gvCard.Columns[i].HeaderStyle.BackColor = System.Drawing.Color.FromArgb(102, 153, 153);

                if ("order by " + e.SortExpression + " asc" == lbSort.Text)
                {
                    lbSort.Text = "order by " + e.SortExpression + " desc";
                    gvCard.Columns[i].HeaderText = gvCard.Columns[i].HeaderText + "^";
                }
                else
                {
                    lbSort.Text = "order by " + e.SortExpression + " asc";
                }

                Refr(false);
            }
        }