【问题标题】:Proper event to populate a ComboBox/DropDownList inside of a Telerik RadGrid在 Telerik RadGrid 中填充 ComboBox/DropDownList 的适当事件
【发布时间】:2015-03-01 17:17:01
【问题描述】:

我试图弄清楚在 Telerik RadGrid 或 CodeBehind 中的任何 ASP.NET 网格中填充 ComboBox 的正确事件是什么。当用户单击一行上的编辑时,ComboBox 应填充其项目。

我见过的唯一示例是在 aspx 页面中使用 DataSourceID 属性。我更喜欢在后面的代码中手动完成所有填充:

ComboBox1.DataSource = colorList;  
Combobox1.DataBind();

【问题讨论】:

  • 是否需要绑定组合框并将选中的项目保存在某处?它是在模板列中还是使用下拉列?您使用的是模板表单还是自动生成的表单?

标签: asp.net combobox webforms telerik telerik-grid


【解决方案1】:

您可以访问以下网格列中的子控件:

  • ItemDataBound - 为每个项目触发(因此您需要检查 GridDataItem 类型或 GridEditItem,具体取决于您的目标)

  • ItemCreated - 类似,但您没有与每个项目关联的数据项对象

  • ItemCommand - 单击“编辑”时会调用“编辑”命令,以便您可以访问它。

【讨论】:

    猜你喜欢
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-23
    • 1970-01-01
    相关资源
    最近更新 更多