开发者

Problem Datagridview and Foreign & Primary key column

I have a datagridview in which the first column is a Foreign Key and part of the Primary key of a table (Linq2sql). I use a combobox for selecting a proper Foreign Key value.

The thing is that as soon as I want to edit a (new) row it immediately throws an error "DataGridViewComboBoxCell value is not valid". I assume this is because it's value is r开发者_如何学Goequired and hence cannot be null (Linq makes it type "int", which does not allow null).

Do I need to supply a default value for the combobox and if so, how/where can I do this?


Handle the DefaultValuesNeeded event

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜