主要是利用 ASPxTreeList 点击事件回发服务器进行数据重新绑定
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); //数据传输回调方法 ASPxTreeList1.PerformCustomCallback(key); //数据绑定回调方法 |
ASPxGridView
|
1 |
oncustomcallback="ASPxGridView1_CustomCallback" |
js中的performcallback方法捎带的参数来进行aspxgridview数据更新,通过aspxgridview的customcallback来实现
js代码如下:
|
1
2
3
4
5
6
7
8
9
10
11
12 |
function onFocusChanged(s,e) { var
key = ""; if
($("ASPxTreeList1") != null) { if
(ASPxTreeList1.GetFocusedNodeKey != null
|| ASPxTreeList1.GetFocusedNodeKey != undefined) { key = ASPxTreeList1.GetFocusedNodeKey(); } } ASPxGridView1.PerformDataCallback(key); //数据传输回调方法 ASPxGridView1.PerformCallback(key); //数据绑定回调方法 } |
C#回调方法:
|
1
2
3
4
5
6
7
8
9
10
11
12 |
protected
void ASPxGridView1_CustomCallback(object
sender, ASPxGridViewCustomCallbackEventArgs e){ string
parm = e.Parameters.Trim(); //有的时候参数可能带有 "," 需要做判断 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> |
每个项 FieldName="POSTCODE" 隐藏也能取到值
js代码如下:
|
1
2
3
4
5 |
function OnGridFocusedRowChanged(index) { ASPxGridView1.GetRowValues(index, ‘POSTCODEID;POSTNAME;POSTCODE;State;IsDelete‘, OnGetRowValues);}// 处理服务器端传回的数据(values是个数组)function OnGetRowValues(values) {} |
C#回调方法:
|
1 |
index = ASPxGridView1 的ASPxGridView1_HtmlRowPrepared 递加 |
Dev控件用法 aspxTreeList 无刷新 aspxGridView 数据,布布扣,bubuko.com
Dev控件用法 aspxTreeList 无刷新 aspxGridView 数据
原文:http://www.cnblogs.com/lyuec/p/3587074.html