UXGridView Server Side Validation

3 replies. Last post: November 8, 2011 8:30 PM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi

I use Client UI MVVM Data Application with RIA Services. I have added Atributes on Metadata Class, eg. DataAnnotations.RequiredAttribute

[Required(ErrorMessage = "Eingabe erforderlich!")]
[StringLength(250, ErrorMessage = "Es sind max. 250 Zeichen erlaubt!")]
public string FQDN { get; set; }

When the Cell is empty, I get the Errormessage in UXGridView Footer and the row has a red background color. Please have a look at attached picture (1). This works fine.

Now, I have to validate also on server side. In my case, the FQDN must be unique. So I have writ following method:

public bool IsComputerFQDNRegistered(string fqdn)
{
    return _qmsEntities.Computer.Where(c => c.FQDN == fqdn).Count() > 0;
}

In Insert and Update method, I call IsComputerFQDNRegistered, like this:

public void InsertComputer(Computer computer)
{
    if (IsComputerFQDNRegistered(computer.FQDN))
    {
        ValidationResult error = new ValidationResult("FQDN ist bereits vorhanden!", new string[] { "FQDN" });
        throw new ValidationException(error, null, computer);
    }

    if ((computer.EntityState != EntityState.Detached))
    {
        _qmsEntities.ObjectStateManager.ChangeObjectState(computer, EntityState.Added);
    }
    else
    {
        _qmsEntities.Computer.AddObject(computer);
    }
}

Now I change one FQDN in UXGridView and leave the row to save the changes. I get a Errormessage (see UXGridViewErrorMessageValitationError.png). I would like display the ValidationResult ErrorMessage (FQDN ist bereits vorhanden). Where can I find this Info?

After clicking OK on Errormessage, I can not see any errors in UXGridView. Only when I mark the row (with Errors) and change in edit mode, the Errormessage will displayed. But in the UXGridView Footer I can not see the message (please have a look at attached picture (2)). It is possible to change this behavoir? It would be great, when the background color would be red.

Thanks for help

Michael

All times are GMT -5. The time now is 2:23 PM.
Previous Next