본문 바로가기

Study/Programming

C# 울트라그리드 멀티헤더

private void InitGrid()
        {
            Util.SetGridFormat(uwgList1, null, 300, ScrollBarView.Vertical);
            uwgList1.DisplayLayout.AllowSortingDefault = AllowSorting.No;

            // 클릭시 수정 가능하도록
            uwgList1.DisplayLayout.CellClickActionDefault = Infragistics.WebUI.UltraWebGrid.CellClickAction.Edit;

            Util.SetGridColumnFormat(uwgList1, "대분류(1차분류)", "CODE1", Unit.Percentage(30), HorizontalAlign.Left);
            Util.SetGridColumnFormat(uwgList1, "중분류(2차분류)", "CODE2", Unit.Percentage(30), HorizontalAlign.Left);
            Util.SetGridColumnFormat(uwgList1, "근무경험직급", "FROM_CD", Unit.Percentage(20), HorizontalAlign.Left);
            Util.SetGridColumnFormat(uwgList1, "근무경험직급", "TO_CD", Unit.Percentage(20), HorizontalAlign.Left);
            Util.SetGridColumnFormat(uwgList1, "CORP_CODE", Unit.Percentage(0), true);
            Util.SetGridColumnFormat(uwgList1, "DEPT_CD", Unit.Percentage(0), true);

            uwgList1.Bands[0].Columns.FromKey("FROM_CD").AllowUpdate = AllowUpdate.Yes;
            uwgList1.Bands[0].Columns.FromKey("TO_CD").AllowUpdate = AllowUpdate.Yes;

           

            //헤더 2줄
            uwgList1.Bands[0].HeaderLayout[0].RowLayoutColumnInfo.SpanY = 2;
            uwgList1.Bands[0].HeaderLayout[1].RowLayoutColumnInfo.SpanY = 2;
            uwgList1.Bands[0].HeaderLayout[2].RowLayoutColumnInfo.SpanX = 2;

            Infragistics.WebUI.UltraWebGrid.ColumnHeader ch = new ColumnHeader(true);
            ch.RowLayoutColumnInfo.OriginY = 1;
            ch.RowLayoutColumnInfo.OriginX = 2;
            ch.Caption = "시작";

            uwgList1.Bands[0].HeaderLayout.Add(ch);

            Infragistics.WebUI.UltraWebGrid.ColumnHeader ch2 = new ColumnHeader(true);
            ch2.RowLayoutColumnInfo.OriginY = 1;
            ch2.RowLayoutColumnInfo.OriginX = 3;
            ch2.Caption = "종료";

            uwgList1.Bands[0].HeaderLayout.Add(ch2);
        }