IRecroGridUpdateRecroGridUpdate Method

Method of data modification or new entry.

Definition

Namespace: Recrovit.RecroGridFramework
Assembly: Recrovit.RecroGrid (in Recrovit.RecroGrid.dll) Version: 6.2.0.24.0102.1
C#
bool RecroGridUpdate(
	IRGDataContext context,
	RGClientParam param,
	RGUIMessages messages
)

Parameters

context  IRGDataContext
The context.
param  RGClientParam
Parameters.
messages  RGUIMessages
Returning messages.

Return Value

Boolean
true if entry is valid; otherwise false.

Example

C#
public partial class Person : IRecroGridInitNew, IRecroGridUpdate, IRecroGridDelete
{
    public bool RecroGridDelete(IRGDataContext context, RGClientParam arg, RGUIMessages messages)
    {
        if (Locked)
        {
            messages.AddError("The record is locked!");
            return false;
        }
        return true;
    }
    public void RecroGridInitNew(IRGDataContext context, RGClientParam arg)
    {
        PersonType = "SC";
    }
    public bool RecroGridUpdate(IRGDataContext context, RGClientParam arg, RGUIMessages messages)
    {
        if (string.IsNullOrEmpty(FirstName))
        {
            //Error message associated with a field from the RecroDict dictionary
            messages.AddError(RecroDict.Get(arg.HttpContext, "Person.Validation", "FirstName"), RecroGrid.Alias2ClientName(arg.RGProperties, "FirstName"));
        }
        if (string.IsNullOrEmpty(LastName))
        {
            messages.AddError(RecroDict.Get(arg.HttpContext, "Person.Validation", "LastName"), RecroGrid.Alias2ClientName(arg.RGProperties, "LastName"));
        }
        return messages.ErrorCount == 0;
    }
}

See Also