zoukankan      html  css  js  c++  java
  • 递归遍历页面控件

            private Control returnCtrl;
            
    /// <summary>
            
    /// 递归遍历页面控件
            
    /// </summary>
            
    /// <param name="oControl"></param>
            private Control LoopingControls(Control oControl)
            {
                
    foreach (Control frmCtrl in oControl.Controls)
                {
                    
    if (frmCtrl is GridView)
                        
    if (((GridView)frmCtrl).ID == ControlToPaginate)
                        {
                            returnCtrl 
    = frmCtrl; break;
                        }

                    
    if (frmCtrl is Repeater)
                        
    if (((Repeater)frmCtrl).ID == ControlToPaginate)
                        {
                            returnCtrl 
    = frmCtrl; break;
                        }

                    
    if (frmCtrl is BaseDataList)
                        
    if (((BaseDataList)frmCtrl).ID == ControlToPaginate)
                        {
                            returnCtrl 
    = frmCtrl; break;
                        }

                    
    if (frmCtrl.HasControls())
                        LoopingControls(frmCtrl);
    //递归遍历
                }
                
    return returnCtrl;
            }
            
    #endregion
  • 相关阅读:
    git-【六】分支的创建与合并
    git-【五】远程仓库
    git-【四】撤销修改和删除文件操作
    git-【三】理解工作区与暂存区的区别
    git-【二】本地git操作提交、版本回退
    git-【一】概述安装
    java-基础-【四】实际编程中的对象
    博客园打赏、赞助功能
    js-template-art【四】通过helper方法注册,调用外部方法
    js-template-art【三】js api
  • 原文地址:https://www.cnblogs.com/wf225/p/939487.html
Copyright © 2011-2022 走看看