2011-11-03 2 views
0

ItemTemplate의 radGrid의 각 행에 Dropdownlist를 동적으로 추가하려고합니다. 그래서 기본적으로 radGrid가로드 될 때 각 행에 DropDOwnList를 추가하고 생성 된 ID를 기반으로 특정 데이터를 추가하려고합니다. 그 일을 어떻게 하죠?동적으로 DropDownList를 radGrid에 추가 ItemTemplate

감사합니다.

답변

0

다음 코드로 시도하십시오.

 <telerik:GridTemplateColumn UniqueName="ADDCombo"> 
      <ItemTemplate> 

      </ItemTemplate> 
      </telerik:GridTemplateColumn> 

...............

if (e.Item is GridDataItem) 
    { 
     GridDataItem item = e.Item as GridDataItem; 

     //get data key 
     string strID = item.GetDataKeyValue("ID").ToString(); 


     RadComboBox RadComboBox2 = new RadComboBox(); 
     // bind your combo here 
     item["ADDCombo"].Controls.Add(RadComboBox2); 
    } 
관련 문제