RadGrid의 DetailTable 컬럼 크기 조절

 

ItemDataBound.... 이벤트에서.

 

//item["EMPTY"].Width = new Unit(75,UnitType.Pixel);    <--설정했지만 크기가 안변함.

//상부로 올려서 헤드를 설정해야 된다는..
item.OwnerTableView.GetColumn("EMPTY").HeaderStyle.Width = Unit.Pixel(75);

 

출처 :  https://www.telerik.com/forums/how-to-set-column-width-in-code-behind-for-detailtable

 

 

 

위에서 크기만 변경되고. Refresh 시.. 기본값으로 초기화됨.

ItemCreate 이벤트에서 설정해주어야함.

 

컬럼 전체가 되니..

DetailTable.KeyValue 로 구분하여..  처리해야함.

근데, 구분자가.. 다행히  ExpandCollapseColumn.Display 발생했던 문제였으므로,

이것으로 구분함. (문제발생한 부분이 구분값의 키구나..)

 

protected void rgClnDept_ItemCreated(object sender, GridItemEventArgs e)
 {
  if (e.Item is GridDataItem)
  {
   GridDataItem item = (GridDataItem)e.Item;

   string[] strKeyValue = item.KeyValues.ToString().Replace("{", "").Replace("}", "").Split(':');

   //키가없으면 기본항목
   if (strKeyValue.Length == 1)
   {

   }
   else if ("CntrNm".Equals(strKeyValue[0]))
   {
     if (!item.OwnerTableView.ExpandCollapseColumn.Display)
     {
      item.OwnerTableView.GetColumn("EMPTY").HeaderStyle.Width = Unit.Pixel(75);
     }
  }
  }
 }

 

출처 : https://www.telerik.com/forums/issue-hiding-detail-table-column-in-self-referencing-hierarchical-grid

 

 

Posted by 말없제이
,