Dev控件用法 aspxTreeList 无刷新 aspxGridView 数据
生活随笔
收集整理的這篇文章主要介紹了
Dev控件用法 aspxTreeList 无刷新 aspxGridView 数据
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Dev控件用法 aspxTreeList 無刷新 aspxGridView 數(shù)據(jù)
主要是利用 ASPxTreeList 點(diǎn)擊事件回發(fā)服務(wù)器進(jìn)行數(shù)據(jù)重新綁定
?
ASPxTreeList:
?| 1 2 | <SettingsBehavior ExpandCollapseAction="NodeDblClick"AllowFocusedNode="True"AllowSort="False"/> <ClientSideEvents? FocusedNodeChanged="function(s, e) { onFocusChanged(s,e);}"????Init="function(s, e) { }"/> |
?
js代碼如下:
?| 1 2 3 4 5 6 7 8 9 | if($("ASPxTreeList1") !=?null) { ????????if(ASPxTreeList1.GetFocusedNodeKey !=?null|| ASPxTreeList1.GetFocusedNodeKey != undefined) { ?????????????key = ASPxTreeList1.GetFocusedNodeKey(); ????????} ????} ??? ASPxTreeList1.PerformCustomDataCallback(key);??//數(shù)據(jù)傳輸回調(diào)方法? ??? ASPxTreeList1.PerformCustomCallback(key);??//數(shù)據(jù)綁定回調(diào)方法 |
?
ASPxGridView?
?| 1 | oncustomcallback="ASPxGridView1_CustomCallback" |
?
js中的performcallback方法捎帶的參數(shù)來進(jìn)行aspxgridview數(shù)據(jù)更新,通過aspxgridview的customcallback來實(shí)現(xiàn)
js代碼如下:
?| 1 2 3 4 5 6 7 8 9 10 11 12 | function onFocusChanged(s,e) { ????varkey =?""; ????if($("ASPxTreeList1") !=?null) { ????????if(ASPxTreeList1.GetFocusedNodeKey !=?null|| ASPxTreeList1.GetFocusedNodeKey != undefined) { ????????????key = ASPxTreeList1.GetFocusedNodeKey(); ????????} ????} ????ASPxGridView1.PerformDataCallback(key);??//數(shù)據(jù)傳輸回調(diào)方法? ??? ASPxGridView1.PerformCallback(key);??//數(shù)據(jù)綁定回調(diào)方法? ??? } |
?
C#回調(diào)方法:
?
?| 1 2 3 4 5 6 7 8 9 10 11 12 | protectedvoidASPxGridView1_CustomCallback(objectsender, ASPxGridViewCustomCallbackEventArgs e) { ???????stringparm = e.Parameters.Trim();?//有的時(shí)候參數(shù)可能帶有 ","? 需要做判斷 ???????try ????????{ ????????????if(!string.IsNullOrEmpty(parm)) ????????????{ ????????????????ASPxGridView1.DataSource = ModuleCode.SelectModuleQuery(parm).Tables[0]; ????????????????ASPxGridView1.DataBind(); ????????????} ????????}??catch(Exception ex) {????? } ??} |
?
獲取ASPxGridView1選擇行的值
?
?| 1 2 3 4 | KeyFieldName="POSTCODEID"??PreviewFieldName="POSTNAME,State,IsDelete">???? ??<ClientSideEvents FocusedRowChanged="function(s, e) { OnGridFocusedRowChanged(); }"/>? ??? ?<dxwgv:GridViewDataDateColumn Caption="崗位"FieldName="POSTCODE"></dxwgv:GridViewDataDateColumn> |
?每個(gè)項(xiàng)? FieldName="POSTCODE" 隱藏也能取到值
?js代碼如下:
?
?| 1 2 3 4 5 | function OnGridFocusedRowChanged(index) {???????? ????????ASPxGridView1.GetRowValues(index,?'POSTCODEID;POSTNAME;POSTCODE;State;IsDelete', OnGetRowValues); } // 處理服務(wù)器端傳回的數(shù)據(jù)(values是個(gè)數(shù)組) function OnGetRowValues(values) {} |
?
?C#回調(diào)方法:
?| 1 | index =? ASPxGridView1 的ASPxGridView1_HtmlRowPrepared? 遞加 |
?
?
歡迎大家踴躍討論并指出不足或錯(cuò)誤的地方,一定及時(shí)改進(jìn)。?
聯(lián)系QQ:106398492
Email:lyuec@sina.com
轉(zhuǎn)載于:https://www.cnblogs.com/ydfq-home/p/5017468.html
總結(jié)
以上是生活随笔為你收集整理的Dev控件用法 aspxTreeList 无刷新 aspxGridView 数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 简单的并发测试工具 ab.exe ab.
- 下一篇: 森林病虫防治系统 (十一)