1

I am working on a DevExpress XAF application, where I need to define one of the properties of a business object with a custom property editor in order to show it with a dropdown list that gets populated from another Business Object like below:

[ImmediatePostData(true)]
[ModelDefault("PropertyEditorType", "CollateralSaleTypePropertyEditor")]
[Size(140)]
public string COLLATERAL_SALE_TYPE
{
    get { return GetPropertyValue<String>("COLLATERAL_SALE_TYPE"); }
    set
    {
        SetPropertyValue("COLLATERAL_SALE_TYPE", value);
        // OnChanged("COLLATERAL_REPOSSESSION_DATE");
    }
}

Furthermore, I have defined the CollateralSaleTypePropertyEditor and have set the AutoPostBack to true: _dropDownControl.AutoPostBack = true;

The problem I am facing is that this post back does not occur, and the server side event of SelectedIndexChanged does not get raised:

//Server side event that is not raised
_dropDownControl.SelectedIndexChanged += control_SelectedIndexChanged;
//Client side event that is raised                   
_dropDownControl.ClientSideEvents.SelectedIndexChanged = "function (sender, e) { e.processOnServer=false;}";

So basically every time I change the selected item nothing happens. I found the following link which explains the reason on updating here. But even after I follow the steps nothing happens.

CDspace
  • 2,639
  • 18
  • 30
  • 36
Kejsi Struga
  • 550
  • 6
  • 21

1 Answers1

0

I think the solution to your problem is obvious. The issue is with this line:

dropDownControl.ClientSideEvents.SelectedIndexChanged = 
                  "function (sender, e) { e.processOnServer=false;}";

Since you have specified e.processOnServer=false, SelectedIndexChanged event is generated at the client side but it will not hit the server.

If you want SelectedIndexChanged to reach the server side you need either to remove the client side handler completely or change it to have e.processOnServer=true;.

andrews
  • 2,173
  • 2
  • 16
  • 29
  • Hey, I solved it and yes the processedOnServer property had to be set to true, this appeared to be an issue of the DropDown control in particular. – Kejsi Struga Oct 16 '17 at 09:14
  • @kejsiStruga glad it helped!. Would appreciate if you accept the answer then. – andrews Oct 16 '17 at 09:15