Data can not drop down box backfilling

开发工具与关键技术:Visual Studio 
作者:肖广斌
撰写时间:2019年6月13日

In the process of doing the project, because if you can not get a foreign key ID when writing the modification can not backfill data? Today I encountered, get less than drop-down box ID can not backfill data, although much of this problem to find time to spend, but I believe we may encounter the same problem, look at the chart
Here Insert Picture Description
above is my writing desk when the bit modified because not obtain the drop-down box ID results in the drop-down box information backfill floors and departments can not, but the state has obtained the ID, which is why na, here I will simply say something behind me get to the id by what method and backfill data, first of all give you a look at my pop-up box to modify the modal code, as shown below
Here Insert Picture Description
first before I pop up a modal box must first select the data, or can not pop up modal box, and then backfill operation to clear the form data when backfilling data because floors and departments are directly related, so to get to the floor, departments will be able to get along,
you can see, I have a drop-down box to binding information data has been written, but it get less floor ID and department ID, the wrong breakpoints, we can see, see below, it gets to the floor id is undefined, the primary key and Id have to get state
Here Insert Picture Description
Here is my solution to the problem, as shown below, and I'm the wording changed a bit, first declare a variable to receive the selected row id get to the floor, then the received id stitching to bind the drop-down the value of the value of the box, there is a way to get less than is the case even when writing queries, not extracted foreign key id field need not check out when querying, modifying time and need to use, then this case also can not obtain foreign key id, also you need to find out in the query, so as to get to the floor id
Here Insert Picture Description
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/qq_44505797/article/details/92400050