I am a fresh learner in C#. I have this code below.I managed to display the data from the property table into their respective text boxes. But I failed to display the filtered propertyunits into the xtraGrid.

private readonly IPropertyService _propertyservice;
private readonly Property _property;

private readonly IPropertyUnitService _propertyUnitService;
private readonly PropertyUnit _propertyUnit;

public frmEditLandlordProperty() {
    InitializeComponent();
    _propertyservice = UnityConfig.GetContainer().Resolve<IPropertyService>();
    _propertyUnitService = UnityConfig.GetContainer().Resolve<IPropertyUnitService>();
}

public frmEditLandlordProperty(int PropertyId) 
    : this(){
        this._property = _propertyservice.GetById(PropertyId);
        this._propertyUnit = _propertyUnitService.GetById(PropertyId);
    }

private void frmEditLandlordProperty_Load(object sender, EventArgs e) {

    propertyBindingSource.DataSource = _property;
    propertyUnitsBindingSource.DataSource = _propertyUnit;

}

Just a guess, but aren't you missing .DataBind()?

   propertyBindingSource.DataSource = _property;
   propertyBindingSource.DataBind();

   propertyUnitsBindingSource.DataSource = _propertyUnit;
   propertyUnitsBindingSource.DataBind();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.