Exemplo n.º 1
0
        /// <summary>
        /// 添加类别到表格中
        /// </summary>
        /// <param name="categories">类别</param>
        public void AddCategoriesToCategoryGrid(List <UserSecurityCategory> categories)
        {
            if (m_gridCategory.EditTextBox != null)
            {
                m_gridCategory.OnCellEditEnd(null);
            }
            m_gridCategory.BeginUpdate();
            int categoriesSize = categories.Count;

            for (int i = 0; i < categoriesSize; i++)
            {
                UserSecurityCategory category = categories[i];
                GridRow row = new GridRow();
                row.Grid = m_gridCategory;
                GridStringCell idCell = new GridStringCell();
                idCell.Text = category.m_categoryID;
                row.AddCell(0, idCell);
                GridStringCell textCell = new GridStringCell();
                textCell.AllowEdit = true;
                textCell.Text      = category.m_name;
                row.AddCell(1, textCell);
                m_gridCategory.AddRow(row);
                if (i == 0)
                {
                    m_gridCategory.OnCellEditBegin(textCell);
                }
            }
            m_gridCategory.EndUpdate();
            m_gridCategory.Invalidate();
        }