Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6613603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:14:17+00:00 2026-05-25T20:14:17+00:00

This is what I have: public class ViewModel { public BindingList<Row> Rows { get;

  • 0

This is what I have:

public class ViewModel
{
    public BindingList<Row> Rows { get; set; }
    public BindingList<MyElement> Selectables { get; set; }
}

public class Row
{
    public MyElement Selected { get; set; }
}

public class MyElement
{
    public string Value { get; set; }
    public string Friendly { get; set; }
}

This is what I want:
An XtraGrid with a column that has a combobox editor in each cell. The values of the dropdown options are different for different rows. Specifically the available options are subsets of ViewModel.Selectables, the subset is defined by businessrules at runtime.

This is how I try to make this happen:

I create three BindingSources

  1. viewModelBindingSource: with DataSource = ViewModel

  2. rowsBindingSource: with DataSource = viewModelBindingSource AND DataMember = Rows

  3. selectablesBindingSource with DataSource = viewModelBindingSource AND DataMember = Selectables

I set the grid’s DataSource to rowsBindingSource.
I create an In-place Editor Repository for a LookupEdit in the grid.
I set the repositoryItemLookUpEdit‘s DataSource to selecteablesBindingSource
I set the repositoryItemLookUpEdit as the ColumnEdit value of the column

I hook up to gridViews ShownEditor event:

this.gridView1.ShownEditor += gridView1_ShownEditor;

In gridView1_ShownEditor(object sender, EventArgs e) method I can then have a reference to the view so I can do something like this:

GridView view = sender as GridView;
var newSelectables = new BindingList<MyElement>();
// businesslogic to populate newSelectables ...
var bs = new BindingSource(newSelectables, "");
edit = (LookUpEdit)view.ActiveEditor;
edit.Properties.DataSource = bs;

This works to the extent that I get the new options in the clicked combobox, and selecting the option sets the value to the bound object, that is Row.Selected.

And now to my problem, when cell looses focus, the cell content turns blank.

This seems to be caused somehow by the fact that I create a new BindingSource with new, because if I ommit this change of DataSource then the values in ViewModel.Selectables are used instead, and it works as expected.

So, does anyone know why the text displayed in the cell goes blank after it looses focus in this case??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:14:18+00:00Added an answer on May 25, 2026 at 8:14 pm

    I had the same issue few days back but i didn’t find any solution for it. What i understood from it is that the values you are binidng to the grid column containing ComboEdit or LookupEdit must match the Vlaue Member value of the ComboEdit/LookUpEdit Collection.

    If it gets find the matched value than it’ll show the display member value in the cell otherwise the cell value will be blank.

    This is what i got from my working experience on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Class: public class User { public string id{ get; set; }
I have something like this public class ViewModel { public List<Books> Test {get; set;}
Suppose I have this model: public class ViewModel { [Required] public string UserInput {
I have a ViewModel: public class Page { public int Id { get; set;
I have a class that roughly looks like this: public class ViewModel { public
Say I have this class: public class Account { public int AccountID { get;
I have a ViewModel. something like this public class ViewModel { public int Id
I have a ViewModel : public class VM { public ObservableCollction<PersonRole> PersonRoles { get;
I have the following nested viewmodel class... public class CustomerModel { public string name;
I have following ViewModel: public IEnumerable<SelectListItem> SelectAdminsInGroup { get; set; } public IEnumerable<SelectListItem> SelectAdminsNotInGroup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.