-1

I have a table called tblSize with these values;

ID (PK)  SIZE
1        MM
2        INCH
3        FEET

Then I have another table tblMember with these values;

 ID (PK)  MEMBER SIZE  MIN_SIZE_ID (FK)  MAX_SIZE_ID (FK)
 1        BOX A             2                     3 
 2        BOX B             3                     1

So now these tables are within data entities so I could Pull the Size value if there was only one Foreign Key but I got 2 foreign keys. So single use would be;

@For Each item as tblMember in Model
    @Html.DisplayFor(Function(m) item.tblSize.Size) 'THIS SHOULD OUTPUT MM/INCH/FEET
Next

But the problem is there there are 2 foreign keys that could individually different, so what I was thinking something like this which does not work;

@For Each item as tblMember in Model
    @Html.DisplayFor(Function(m) item.MIN_SIZE_ID.tblSize.Size) 'THIS SHOULD FK TO MINIMUM
    @Html.DisplayFor(Function(m) item.MAX_SIZE_ID.tblSize.Size) 'THIS SHOULD FK TO MAXIMUM
Next

If I try the above then I get error on the tblSize.Size. Without the tblSize using MIN_SIZE_ID only I will get the ID passed to the output.

Kiel
  • 203
  • 2
  • 12

1 Answers1

0

So after posting this nobody helped apart from getting an admin editing my post because of a bit a grammar, thanks for disregarding my question and fixing my grammar appreciated.

THE FIX

I went Inside the tblSize I noticed the telesense found a tblSize1 and a tblMember1 which I could only assume this was the multiple foreign keys that it found.

When analysing the edmx model I could see the 2 foreign keys pointing to tblSize and tblSize1 so I renamed them there one for tblSize_Min and one for tblSize_Max then within the view I could then use the telesense to bring up;

@Html.DisplayFor(Function(m) item.tblSize_Min.SIZE) 'THIS SHOULD FK TO MINIMUM
@Html.DisplayFor(Function(m) item.tblSize_Max.SIZE) 'THIS SHOULD FK TO MAXIMUM

Like I said before this post got edited, I am new to MVC and need a little help no matter how small.

Kiel
  • 203
  • 2
  • 12