• Dev控件用法 aspxTreeList 无刷新 aspxGridView 数据


    主要是利用 ASPxTreeList 点击事件回发服务器进行数据重新绑定

    ASPxTreeList:

     <SettingsBehavior ExpandCollapseAction="NodeDblClick" AllowFocusedNode="True" AllowSort="False" />
     <ClientSideEvents  FocusedNodeChanged="function(s, e) { onFocusChanged(s,e);}"    Init="function(s, e) { }" />
    

      

    js代码如下:

    if ($("ASPxTreeList1") != null) {
            if (ASPxTreeList1.GetFocusedNodeKey != null || ASPxTreeList1.GetFocusedNodeKey != undefined) {
                 key = ASPxTreeList1.GetFocusedNodeKey();
            }
        }
     
    ASPxTreeList1.PerformCustomDataCallback(key);  //数据传输回调方法 
     
    ASPxTreeList1.PerformCustomCallback(key);  //数据绑定回调方法 
    

    ASPxGridView 

    oncustomcallback="ASPxGridView1_CustomCallback" 
    

      

    js中的performcallback方法捎带的参数来进行aspxgridview数据更新,通过aspxgridview的customcallback来实现

    js代码如下:

    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#回调方法: 

    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选择行的值  

    KeyFieldName="POSTCODEID"  PreviewFieldName="POSTNAME,State,IsDelete">    
      <ClientSideEvents FocusedRowChanged="function(s, e) { OnGridFocusedRowChanged(); }"/> 
     
     <dxwgv:GridViewDataDateColumn Caption="岗位" FieldName="POSTCODE"></dxwgv:GridViewDataDateColumn>   
    

     每个项  FieldName="POSTCODE" 隐藏也能取到值

     js代码如下:

    function OnGridFocusedRowChanged(index) {        
            ASPxGridView1.GetRowValues(index, 'POSTCODEID;POSTNAME;POSTCODE;State;IsDelete', OnGetRowValues);
    }
    // 处理服务器端传回的数据(values是个数组)
    function OnGetRowValues(values) {}
    

     

     C#回调方法:

    index =  ASPxGridView1 的ASPxGridView1_HtmlRowPrepared  递加
    

      

     

  • 相关阅读:
    从外部访问 Template (模板)的控件、获取它的属性值
    继续聊WPF——动态数据模板
    WPF数据模板样式选择器
    深入理解正则表达式
    nssm使用,安装服务、删除服务
    Windows删除某服务
    nssm设置solr开机启动服务
    Windows下直接双击可执行的jar
    Unsupported major.minor version 52.0——解决
    js延迟2秒执行事件
  • 原文地址:https://www.cnblogs.com/lyuec/p/3587074.html
Copyright © 2020-2023  润新知