This is a migrated thread and some comments may be shown as answers.

having issues with binding etc.

2 Answers 56 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
kieron
Top achievements
Rank 1
kieron asked on 07 Oct 2011, 08:19 AM
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
type_id

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 Answers, 1 is accepted

Sort by
0
kieron
Top achievements
Rank 1
answered on 11 Oct 2011, 01:17 AM
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.
0
Damyan Bogoev
Telerik team
answered on 11 Oct 2011, 04:35 PM
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.

Tags
Getting Started
Asked by
kieron
Top achievements
Rank 1
Answers by
kieron
Top achievements
Rank 1
Damyan Bogoev
Telerik team
Share this question
or