I have modified the UpdateCommand code to look as follows:
// Get the item to be updated
this.grdClientFacility.EditItemIndex = e.Item.ItemIndex;
// Retrieve the previous Categories DataSet
DataSet dsWaitingFacility = (DataSet)Session["dsWaitingFacility"];
// Save the DataSet (the DataGrid automatically binds back)
if (this.Save(this.oWaitingFacility, dsWaitingFacility, this.oWaitingFacility.TableName) == mmSaveDataResult.RulesPassed)
{
// Reset the edited item and rebind the DataGrid
this.grdClientFacility.EditItemIndex = -1;
}
else
{
this.grdClientFacility.EditItemIndex = e.Item.ItemIndex;
}
this.BindControl(this.grdClientFacility);
The code will maintain the edit mode on the current record. But the error icon does not appear beside the grid, nor in the column heading (if that is where I should expect it.) The message at the top of the web form does appear, telling the user to look for the icons.
The error should connect to the object named "Priority". The rule is shown below.
How can I have the error icon appear beside the grid or column?
public string ValidatePriority(int Priority)
{
string message = null;
if (Priority == 0)
{
message = "The Priority must be greater than 0.";
this.AddErrorProviderBrokenRule("Priority",message);
}
return message;
}