c# - DropDownList DataSource set to EF bindingsource gives "The property 'BackupFileID' is part of the object's key information and cannot be modified." -
i have combo box(dropdownlist) data source bound backupfilesbindingsource, displays backup file paths members of list. when selection in dropdown changes, loads image picturebox on form.
in form_load have following:
backupfilesbindingsource.datasource = this._entities.recordbackupfilepaths .where(x => x.recordid == _selectedrecord.recordid); if (_uiimagesqcombobox.selectedindex == backupfilesbindingsource.count - 1) { // ensure image displayed _uiimagesqcombobox_selectedindexchanged(this, eventargs.empty); } _uiimagesqcombobox.selectedindex = (backupfilesbindingsource.count - 1); when have more 1 backup file, when form loads, error:
"the property 'backupfileid' part of object's key information , cannot modified."
which thrown @ reportpropertychanging("backupfileid");
[edmscalarpropertyattribute(entitykeyproperty=true, isnullable=false)] [datamemberattribute()] public global::system.int32 backupfileid { { return _backupfileid; } set { if (_backupfileid != value) { onbackupfileidchanging(value); reportpropertychanging("backupfileid"); _backupfileid = structuralobject.setvalidvalue(value); reportpropertychanged("backupfileid"); onbackupfileidchanged(); } } } dropdownlist binding settings: 
i understand backupfileid property key, can't understand attempted modified, since doing changing selected item in dropdownlist.
thanks help!
Comments
Post a Comment