【问题标题】:Dynamically Add DropDownList to radGrid ItemTemplate将 DropDownList 动态添加到 radGrid ItemTemplate
【发布时间】:2011-11-03 00:18:46
【问题描述】:

我正在尝试将 Dropdownlist 动态添加到 ItemTemplate 中 radGrid 的每一行。所以基本上当 radGrid 加载时,我想将 DropDOwnList 添加到每一行,并根据创建的 id 向其中添加某些数据。我该怎么做呢?

谢谢!

【问题讨论】:

    标签: c# asp.net telerik radgrid


    【解决方案1】:

    试试下面的代码。

            <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);
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多