Dear Telerik support team,
In the "Grid / Form Template Edit Form" example on this website, in Default.CS.aspx.cs class, there's a code block which runs when the user updates a record as shown below.
protected void RadGrid1_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)
{
if (e.Exception != null)
{
e.KeepInEditMode = true;
e.ExceptionHandled = true;
DisplayMessage(true, "Employee " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"] + " cannot be updated. Reason: " + e.Exception.Message);
}
else
{
DisplayMessage(false, "Employee " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"] + " updated");
}
}
The code above displays the notification message "Employee 3 updated"
If I want this notification message to display a message like "Employee Robert King updated" how do I accomplish this?
I tried to use the code shown below but I don't think the code works correctly because the variable IDNumber gets the value from the field EmployeeID rather than the RadGrid's ItemIndex which starts from 0.
int IDNumber = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"];
In the "Grid / Form Template Edit Form" example on this website, in Default.CS.aspx.cs class, there's a code block which runs when the user updates a record as shown below.
protected void RadGrid1_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)
{
if (e.Exception != null)
{
e.KeepInEditMode = true;
e.ExceptionHandled = true;
DisplayMessage(true, "Employee " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"] + " cannot be updated. Reason: " + e.Exception.Message);
}
else
{
DisplayMessage(false, "Employee " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"] + " updated");
}
}
The code above displays the notification message "Employee 3 updated"
If I want this notification message to display a message like "Employee Robert King updated" how do I accomplish this?
I tried to use the code shown below but I don't think the code works correctly because the variable IDNumber gets the value from the field EmployeeID rather than the RadGrid's ItemIndex which starts from 0.
int IDNumber = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"];
string EmployeeName = RadGrid1.MasterTableView.Items[IDNumber]["FirstName"].Text;
DisplayMessage(false, "Employee " + EmployeeName + " updated")
Many thanks,