DevExpress ASPxListBox 使用方法 积累

来源:互联网 发布:淘宝网店代理是什么 编辑:程序博客网 时间:2024/05/17 08:35

1、ASPxListBox 数据绑定 Item 添加 删除

DevExpress 官方帮助:

The ASPxListBox control allows you to modify the ASPxListEdit.Items collection on callbacks only (e.g. add and remove items, populate the controls with new data from a data source, etc.).

It is not possible, for example, to modify a column collection, change items selection, or change SelectionMode on callbacks. To perform these actions on the client side, you can wrap the control with theASPxCallbackPanel control and process a required scenario on a callback to the panel.


添加删除Item只能在callback事件中处理,客户端调用语句:

                                        <dx:ASPxButton ID="btnDeleteUpload" runat="server" Text="删除已有" AutoPostBack="false"
                                            Style="margin: 16px auto;">
                                            <ClientSideEvents Click="function(s, e) { listAttachment.PerformCallback(listAttachment.GetSelectedIndex());}" />
                                        </dx:ASPxButton>
PerformCallback的参数可以传递要删除的ItemIndex。

服务器端:protected void listAttachment_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) 中处理数据绑定或者删除Item ,利用e.Parameter的值来判断。