更改下拉列表中显示的字段
我有一个动态数据网站,在将记录插入表中时,显示为下拉列表的外键关系为其选择项文本值使用了错误的字段。
如何更改下拉列表,以便在使用这个表时,它将使用不同的列作为下拉列表中的值?
谢谢
I have a Dynamic Data website and while inserting a record into a table, the foreign key relationship shown as a drop-down uses the wrong field for it's select item text value.
How can I change the drop-down such that when working with this one table, it will use a different column as the value in the drop-down?
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是添加一个带有 System.ComponentModel.DataAnnotations 命名空间中的一些属性的分部类。集会。请注意下面的[DisplayColumn("Description")]。这就是用于呈现为列表中文本的字段。
进一步阅读
The solution is to add a partial class with some attributes from the System.ComponentModel.DataAnnotations namespace & assembly. Notice the [DisplayColumn("Description")] below. That's what field is used to render as the text in a list.
Further reading