having issues with binding etc.

Thread is closed for posting
3 posts, 0 answers
  1. kieron
    kieron avatar
    9 posts
    Member since:
    Dec 2010

    Posted 07 Oct 2011 Link to this post

    Hi I am playing around within open access and having some issues.

    I have created 2 entities as below

    projectMaster          projectStatus
    Id                Id
    Name              statusdesc
    many to 1 relationship

    This is mapped to below tables

    project_master      project_status
    Id                  id
    name                typedesc

    I then create a simple winform app with a few controls 2 textboxes 1 for ID and 1 for name and a lookupedit for status.

    i then create a binding source
    and set the datasource as below

    var Projectmasterquery = from pm in dbcontext.projectMasters select pm;
    projectMasterBindingSource.DataSource = Projectmasterquery.ToList();

    and i setup another datasource to fill the lookupedit values like below
    var querystatus = from p in dbcontext.projectStatus select p;
    projectStatusBindingSource.DataSource = querystatus.ToList();

    Now i bind the textboxes with
    this.Project_id_textedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "projectId", true));
    this.ProjectName_textedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "projectname", true));

    and then i bind the lookupedit editvalue as below.
    this.Status_lookupedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "ProjectStatus.statusId", true));

    When i run the app it loads the data fine for the 1 record in the database, and i can change the project name and .savechanges() and it records that save and updates the database however when i change the lookupedit value and click savechanges() nothing happens? am i doing something wrong I think im doing somethign wrong with the foreign key to the status table but it loads the value from there fine? i cant find any examples on binding textboxes and foreign keys on the web.
  2. kieron
    kieron avatar
    9 posts
    Member since:
    Dec 2010

    Posted 10 Oct 2011 Link to this post

    I have managed to figure out what it was for some reason the forward mapper didnt setup the foreign key correctly i did that manually and it worked.
  3. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 11 Oct 2011 Link to this post

    Hello Kieron,

    I am glad to see that you managed to resolve the problem on your side. If any other questions arise, do not hesitate to contact us back.

    Best wishes,
    Damyan Bogoev
    the Telerik team

    Check out the latest stable build of Telerik OpenAccess ORM. Download it and benefit from our new Project Templates.

Back to Top