如何从 RadComboBox 的服务器端 DataBinding 事件中获取包含的网格键
How to get the containing grids key from within the server side DataBinding event of a RadComboBox
我正在尝试根据详细信息网格 ID 值唯一地设置 radcombobox 数据源。我想在每个详细信息 table 视图的组合框中使用不同的值。
这是服务器端事件代码:
protected void MethodRadComboBox_DataBinding(object sender, EventArgs e)
{
RadComboBox combo = (RadComboBox)sender;
combo.DataSource = ...need key of details GridTableView DataKey value in order to set the source
}
<CommandItemTemplate>
<telerik:RadComboBox ID="MethodRadComboBox" runat="server" AutoPostBack="true"
AllowCustomText="true"
EmptyMessage="Select a Method."
DataTextField="MethodName" DataValueField="MethodName"
AppendDataBoundItems="true"
OnDataBinding="MethodRadComboBox_DataBinding"
OnSelectedIndexChanged="MethodRadComboBox_SelectedIndexChanged">
</telerik:RadComboBox>
</CommandItemTemplate>
<Columns>
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridCommandItem)
{
GridCommandItem commandItem = (GridCommandItem)e.Item;
RadComboBox combo = (RadComboBox)commandItem.FindControl("MethodRadComboBox");
combo.DataSource = e.Item.OwnerTableView.DataSource;
combo.DataBind();
我正在尝试根据详细信息网格 ID 值唯一地设置 radcombobox 数据源。我想在每个详细信息 table 视图的组合框中使用不同的值。
这是服务器端事件代码:
protected void MethodRadComboBox_DataBinding(object sender, EventArgs e)
{
RadComboBox combo = (RadComboBox)sender;
combo.DataSource = ...need key of details GridTableView DataKey value in order to set the source
}
<CommandItemTemplate>
<telerik:RadComboBox ID="MethodRadComboBox" runat="server" AutoPostBack="true"
AllowCustomText="true"
EmptyMessage="Select a Method."
DataTextField="MethodName" DataValueField="MethodName"
AppendDataBoundItems="true"
OnDataBinding="MethodRadComboBox_DataBinding"
OnSelectedIndexChanged="MethodRadComboBox_SelectedIndexChanged">
</telerik:RadComboBox>
</CommandItemTemplate>
<Columns>
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridCommandItem)
{
GridCommandItem commandItem = (GridCommandItem)e.Item;
RadComboBox combo = (RadComboBox)commandItem.FindControl("MethodRadComboBox");
combo.DataSource = e.Item.OwnerTableView.DataSource;
combo.DataBind();