Reputation: 6065
I'm using C# 4 and ASP.Net. I'm using Telerik at version 2012.1.228.40.
I generate dynamically column names while building my datasource and I would like to get this column name back when the user updates a row.
protected void radGridTranslation_ItemCommand(object _sender, GridCommandEventArgs _event)
{
if (_event.Item is GridDataItem)
{
GridDataItem l_dataItem = (GridDataItem)_event.Item;
string l_sColumnName = ... ? ...
}
}
Edit (after hutchonoid post) : I don't want to know the column names in my code behind. They need to be dynamically built from a database query. Therefore, I cannot use properties such as UniqueName
.
Any idea how I would do that ?
Upvotes: 1
Views: 1333
Reputation: 6065
Here is something that worked :
protected void radGridTranslation_ItemCommand(object _sender, GridCommandEventArgs _event)
{
if (_event.Item is GridDataItem)
{
if (_event.CommandName == myRadGrid.UpdateCommandName)
{
GridDataItem l_dataItem = (GridDataItem)_event.Item;
Dictionary<string, string> l_gridUpdatedItemList = new Dictionary<string, string>();
l_dataItem.ExtractValues(l_gridUpdatedItemList);
foreach (KeyValuePair<string, string> l_updatedItemWithColumn in l_gridUpdatedItemList)
{
// Key = The column name
// Value = The cell value
}
}
}
}
Hope it will help someone else !
Upvotes: 1