开发者

Asp.Net, Dynamic Data Website, Foreign key One to One relationship, DropdownList, how to customise?

开发者 https://www.devze.com 2022-12-23 03:29 出处:网络
I\'m using Asp.Net\'s Dynamic Data Website p开发者_运维知识库roject type. I\'ve created a db that has one to onerelationship between two tables specified using a foreign key, (this could be one to man

I'm using Asp.Net's Dynamic Data Website p开发者_运维知识库roject type. I've created a db that has one to onerelationship between two tables specified using a foreign key, (this could be one to many but I've used the linq designer to change it to a one to one relationship).

i.e. I have a table Invoice and table CreditNote that takes an Invoice_Id as a foreign key

I was hoping that when I navigated to CreditNotes/Insert.aspx that it would display the a list of InvoiceIds in a dropdown list. It almost does this - it creates dropdownlist but only populates option value and not the text so I get something like this in the html source (notice only the value is populated - which looks empty to the user):

<select>
    <option value="someInvoiceId"></option>
    <option value="someInvoiceId"></option>
  </select>

Can anyone tell me how I could fix this? Thanks in advance for any help!


Hey I just stumbled over this question look for another answer but I think that you might need to set up some more meta data on your model such as the adding attributes so that you can define which field should be used

  • http://ericphan.info/blog/2009/2/24/aspnet-dynamic-data-display-custom-text-in-a-foreign-key-dro.html
0

精彩评论

暂无评论...
验证码 换一张
取 消