Hello,
I have a radgrid created dynamically. It contains an GridTemplateColumn with an ItemTemplate and an EditItemTemplate created programmatically too.
The MasterTableView's EditMode is set to InPlace. When i update my row, I fire the UpdateCommand event, but the hashtable does not contain any value.
I have a radgrid created dynamically. It contains an GridTemplateColumn with an ItemTemplate and an EditItemTemplate created programmatically too.
The MasterTableView's EditMode is set to InPlace. When i update my row, I fire the UpdateCommand event, but the hashtable does not contain any value.
if
(e.CommandName == RadGrid.UpdateCommandName)
{
if
((e.Item
is
GridEditableItem) && (e.Item.IsInEditMode))
{
GridEditableItem item = (GridEditableItem)e.Item;
TextBox txtAmount =
new
TextBox();
TextBox txtQuantity =
new
TextBox();
int
ID_Profil = Convert.ToInt32(item.GetDataKeyValue(
"ID_Profil"
));
if
(ID_Profil != 0)
{
DataTable objectifsTable =
this
.GridSource;
//Locate the changed row in the DataSource
DataRow[] changedRows = objectifsTable.Select(
"ID_Profil = "
+ ID_Profil.ToString());
if
(changedRows.Length != 1)
{
e.Canceled =
true
;
return
;
}
//Update new values
Hashtable newValues =
new
Hashtable();
grd_objectifs.Items[item.ItemIndex].ExtractValues(newValues);
changedRows[0].BeginEdit();
try
{
foreach
(DictionaryEntry entry
in
newValues)
{
changedRows[0][(
string
)entry.Key] = entry.Value;
}
changedRows[0].EndEdit();
}
catch
(Exception ex)
{
changedRows[0].CancelEdit();
e.Canceled =
true
;
}
}
}
}