Hi,
I’m trying to bind a GridDropDownColumn dynamically to a RadGrid.
Each row in the RadGrid has an independent GridDropDownColumn and values in these dropdown is not the same in the rest of the rows.
Say, there a row ‘CountyCode’ and has a GridDropDownColumn with a set of CountryCodes.
And the next row may be States and the GridDropDownColumn will have the StatesList.
But when I identify the GridDropDownColumn with a UniqueName, all the dropdown vales in the Grid gets updated with the last set of values.
(Got an example from telerik.com to Customize/Configure GridDropDownColumn)
Please let me know how to identify a specific row in a RadGrid & just bind that GridDropDownColumn in that row.
Here is the code I’m working on.
protected void RadGrid_ItemDataBound (object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
GridEditManager editMan = editedItem.EditManager;
int i = 0;
foreach (CommonConfigurationDataItem cd in _configData)
{
try
{
if (cd.Values != null && cd.Values.Count > 0)
{
GridDropDownColumnEditor editor = editMan.GetColumnEditor("List") as GridDropDownColumnEditor;
editor.DataSource = cd.Values;
editor.DataBind();
}
//’i’ would be a row index – How do I access the GridDropDownColumn in that row using i//
}
i++;
}
}
}
private void AddComboBoxPDValues()
{
if (RadGrid.Columns.Contains("List"))
RadGrid.Columns.Remove("List");
GridDropDownColumn List = new GridDropDownColumn();
List.HeaderText = "Provisioned Values";
List.ReadOnly = false;
List.UniqueName = "List";
RadGrid.Columns.Add(List);
}
Thanks!
Vinya