Add SubEntity problem

2 posts, 0 answers
  1. Pierre
    Pierre avatar
    227 posts
    Member since:
    Apr 2007

    Posted 24 Aug 2010 Link to this post

    What do I do wrong:

    I got a entity like that:

    public partial class Adresse
         internal sealed class AdresseMetadata
             // Metadata classes are not meant to be instantiated.
             private AdresseMetadata()
             public string Adresse1 { get; set; }
             public string GPS1 { get; set; }
             public string GPS2 { get; set; }
             public int ID { get; set; }
             [Association("Telephone", "ID", "AdresseID")]
             public EntityCollection<Telephone> Telephone { get; set; }

    Than I got a wizard that create new Adresse entity manually. The NouvAdresse is a public property located in my view model.
    NouvAdresse = new(Adresse);
    NouvAdresse.GPS1 = "12345";
    NouvAdresse.GPS2 = "12345";

    At one step of the wizard, I got a RadGridView to add some phone number. The grid is binded with the public property NouvAdresse.Telephone
    I got a button the do a RadGridTel.BeginInsert();
    Then a codebiend function that instanciate an emptu phone entity:
    private void GridTelephone_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
        Telephone Tel = new Telephone();
        Tel.TypeTelephoneID = 1;
        e.NewObject = Tel;

    When the entry is complete I got this code to add id in the Telephone collection of my Adresse Entity:
    private void GridTelephone_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
        if (e.EditedItem != null)
            Telephone Tel = (Telephone)e.EditedItem;
            if (Tel.Numero != null && Tel.Numero.Length > 0)

    The row is added and visible to the grid. The Grid add automatically a new row with title "Click here to add new item". At this point if I click on this new row, or if I click on my custom add buton. The a new empty line appear and I can add my second phone number. But if I commit this line, the RowEditEnd is called and the new phone is added to the Adresse.Telephone collection. But this new line never show up in the Grid.

    Any suggestion?
  2. Nedyalko Nikolov
    Nedyalko Nikolov avatar
    871 posts

    Posted 27 Aug 2010 Link to this post

    Hello Pierre,

    I cannot figure out what the problem is, according to the information everything seems to be correct.
    Could you please send me a sample project which I can debug on my side, since this weird behavior sounds like a bug to me?
    Thank you in advance.

    Nedyalko Nikolov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top