Hi,
I have used InsertCommand when inserting new rows to the radgrid.
protected
void
grvTasks_InsertCommand(
object
sender, GridCommandEventArgs e)
{
var editableItem = ((GridEditableItem)e.Item);
GetTasks();
if
(_taskListMain !=
null
)
{
Task newTask =
new
Task(_taskListMain.DataConnections);
Hashtable values =
new
Hashtable();
editableItem.ExtractValues(values);
if
(values[
"Name"
] !=
null
)
newTask.Name = (
string
)values[
"Name"
];
if
(values[
"Description"
] !=
null
)
newTask.Description = (
string
)values[
"Description"
];
if
(values[
"EstimateInHours"
] !=
null
)
newTask.EstimateInHours =
int
.Parse(values[
"EstimateInHours"
].ToString());
_taskListMain.Tasks.TaskRows.Add(newTask);
_taskListMain.Tasks.Save();
}
}
I copy data from each field from hashtable to the final class properties. This means lot of rows if there are lot of fields, so I wondering is there another way to copy inserted data from GridEditableItem to final custom class? e.g. Similar function what is use in UpdateCommand ( editableItem.UpdateValues(task);)
Regards,
Auvo