简体   繁体   English

在自定义PropertyEditor中使用ASPxComboBox的PostBack不会在DevExpress中触发

[英]PostBack of ASPxComboBox not firing in DevExpress when used in a custom PropertyEditor

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: 我正在开发一个DevExpress XAF应用程序,在这里我需要使用自定义属性编辑器定义业务对象的属性之一,以便使用从另一个业务对象填充的下拉列表来显示它,如下所示:

[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; 此外,我定义了CollateralSaleTypePropertyEditor并将AutoPostBack设置为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: 我面临的问题是不会发生此回发,并且不会引发SelectedIndexChanged的服务器端事件:

//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. 但是即使按照这些步骤进行,也不会发生任何事情。

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. 由于已指定e.processOnServer=false ,因此在客户端生成了SelectedIndexChanged事件,但不会在服务器上发生。

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; 如果希望SelectedIndexChanged到达服务器端,则需要完全删除客户端处理程序或将其更改为e.processOnServer=true;否则,请e.processOnServer=true; .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM