あなたのコードが無効な型に戻り値gridView.GetRowCellValue(rowHandle, "Confirm")
をキャストしていると思われることがあります。 as
演算子を使用して、以下のコード行を変更します。
CheckedListBoxItem confirms = gridView.GetRowCellValue(rowHandle, "Confirm") as CheckedListBoxItem;
if(confirms != null){}
へ
CheckedListBoxItem confirms =(CheckedListBoxItem)(gridView.GetRowCellValue(rowHandle, "Confirm"));
デバッグに結果であるものを得る知っているだろうことを行った後。
私はそのエディタは、あなたがgridView.GetRowCellValue()
から結果を取得する列Confirm
が装着されて見ることができるように
は
User
クラスではない
CheckedListBoxItem
の
Id
プロパティ値です。
gridView.CloseEditor();
を呼び出すと、CheckedListBoxItemを取得するエディタは存在しません。 ColumnView.ShownEditor Eventでエディタにアクセスできます。以下のコードを参照してください:
private void MainForm_Load(object sender, EventArgs e) {
this.PhonesSource.DataSource = DataContext.GetPhones();
this.CountriesSource.DataSource = DataContext.GetCountries();
this.CitiesSource.DataSource = DataContext.GetAllCities();
}
private void GridView_ShownEditor(object sender, EventArgs e) {
ColumnView view = (ColumnView)sender;
if (view.FocusedColumn.FieldName == "CityCode") {
LookUpEdit editor = (LookUpEdit)view.ActiveEditor;
string countryCode = Convert.ToString(view.GetFocusedRowCellValue("CountryCode"));
editor.Properties.DataSource = DataContext.GetCitiesByCountryCode(countryCode);
}
}
// In certain scenarios you may want to clear the secondary editor's value
// You can use the RepositoryItem.EditValueChanged event for this purpose
private void CountryEditor_EditValueChanged(object sender, EventArgs e) {
this.GridView.PostEditor();
this.GridView.SetFocusedRowCellValue("CityCode", null);
}
private void MainForm_Load(object sender, EventArgs e) {
this.PhonesSource.DataSource = DataContext.GetPhones();
this.CountriesSource.DataSource = DataContext.GetCountries();
this.CitiesSource.DataSource = DataContext.GetAllCities();
}
private void GridView_ShownEditor(object sender, EventArgs e) {
ColumnView view = (ColumnView)sender;
if (view.FocusedColumn.FieldName == "CityCode") {
LookUpEdit editor = (LookUpEdit)view.ActiveEditor;
string countryCode = Convert.ToString(view.GetFocusedRowCellValue("CountryCode"));
editor.Properties.DataSource = DataContext.GetCitiesByCountryCode(countryCode);
}
}
・ホープ、このヘルプ..
あなたが「確認」欄に何を保存しますか?私はリストのデータソースから見ることができます。 UserのIdプロパティと同様のデータ型を持つ必要があります。 –
@NiranjanKalaどういう意味ですか?私は鋳造する必要がある質問 –