Automatic refresh entityframework calculated field

0 Answers 99 Views
GridView
Sami
Top achievements
Rank 2
Iron
Iron
Iron
Sami asked on 01 Nov 2022, 11:52 PM
 

Hi:

Hi have a not mapped calculated field on entity framework; The value changes  based on other property, but the datagrid doesnt reflect the change inmediatly, how can I solve it?

public int Longitud
        {
            get
            {
                if (Nombre != null)
                {
                    int resultado= Nombre.Length;
                   // OnPropertyChanged(nameof(Longitud));
                    return resultado;
                }
                else
                return 0;
            }

        }

            
Martin Ivanov
Telerik team
commented on 02 Nov 2022, 08:52 AM

Probably, you should call the OnPropertyChanged() method in the setter of the other property. For example:

public object Nombre
{
	get { return this.nombre; }
	set
	{
		this.nombre = value;
		OnPropertyChanged("Nombre");
		OnPropertyChanged("Longitud");
	}
}

Sami
Top achievements
Rank 2
Iron
Iron
Iron
commented on 02 Nov 2022, 10:36 PM

Thanks for all your help

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Sami
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or