mardi 5 mai 2015

Kendo grid populates and posts all of the navigation properties

I have a Kendo Grid for Serial class. This class has relation with row class, but I don't use any of the navigation properties in my Grid and I don't need them in this particular page.

The problem is Kendo populates all of the foreign key relations. So the row class and all of the navigation properties of itself will be populated. When I try to save my edit, Kendo posts all of these data and this causes ModelState.IsValid always be false. Do you have any suggestion?

This is the Serial class, and I have a field for each property.

public class Serial
{
    [Key]
    [Column(TypeName = "BIGINT", Order = 0)]
    public Int64 LiIdR { get; set; }
    [ForeignKey("LiIdR")]
    public virtual Rows Row { get; set; }

    [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public Int16 SRadifS { get; set; }
    public string AFromSerial { get; set; }
    public string AToSerial { get; set; }
    public int? IQnty { get; set; }
    public string AExpireDate { get; set; }
    public string AComment { get; set; }
}

Aucun commentaire:

Enregistrer un commentaire