0

我想在 Telerik Rad Grid 的编辑模式的单列中加载不同的控件,如 DROPDOWN、RADIO。

意味着每一行,我想从数据库中传递一些值,比如


编号 | 控制|

1 | 下拉
2 | 收音机
3 | 复选框

现在,当我在 column 中传递 1 时,telerik 网格应该在编辑模式下加载下拉框。如果我在另一行中传递 2 而不是在同一列中传递,但在该特定行中,它应该在编辑模式下加载单选按钮。

有可能吗?

4

1 回答 1

0

you have to set AutoGenerateColumns="False" and then create your custom "RadGridTemplateColumn"'s in your ascx-file. In each TemplateColumn you can define "HeaderTemplate", "ItemTemplate", "EditTemplate". The EditTemplate will be shown if you are in edit mode. In this you can show your controls.

Iam not sure what you exactly mean but I think you wanna show a dropdownlist in the Row 0 of your grid and in the next item (Row 1) you wanna show at the same position a radiobuttonlist right?

You can achive this by using the Event "OnItemDataBound".

if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
}

use this to be sure that you are in the editmode. There you can for example hide some controls or maybe create them dynamically and add them to the page. If you wanna create new controls dynamically I would suggest you to place a asp:PlaceHolder at the specific position in your ascx-file.

hope I understood you right.

best regards, noone.

于 2012-05-10T12:05:18.847 回答