轉帖|使用教程|編輯:龔雪|2017-01-23 13:12:02.000|閱讀 910 次
概述:ASPxListBox使用技巧及代碼示例
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
在ASPxListBox中如何進行數據綁定,添加或刪除Item?
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.
(來自DevExpress 官方幫助文檔)
添加刪除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的值來判斷。
如何實現在listbox中選中所有button?
// Set - SelectionMode="Multiple" for your ListBox and then do protected void LinkButton1_Click1(object sender, EventArgs e) { foreach (ListItem li in ListBox1.Items) { li.Selected = true; } }
想要了解更多DevExpress使用技巧?海量視頻課程以及最專業的DevExpress培訓盡在。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn