当前位置: 首页>>代码示例>>C#>>正文


C# Control.HasControls方法代码示例

本文整理汇总了C#中Control.HasControls方法的典型用法代码示例。如果您正苦于以下问题:C# Control.HasControls方法的具体用法?C# Control.HasControls怎么用?C# Control.HasControls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Control的用法示例。


在下文中一共展示了Control.HasControls方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsFormTagNeeded

        // Recursive method to check if there is any descendant control
        // requires the form tag.  For unknown cases, the method returns true
        // in case the unknown rendering requires the form tag.
        private bool IsFormTagNeeded(Control control)
        {
            // Check itself first
            if (!control.Visible)
            {
                return false;
            }

            MobileControl mobileControl = control as MobileControl;
            if (mobileControl != null)
            {
                // Since we don't have control over what content is included
                // in the template, to be safe we just generate the form tag.
                if (mobileControl.IsTemplated)
                {
                    return true;
                }

                HtmlControlAdapter adapter = mobileControl.Adapter as HtmlControlAdapter;
                if (adapter != null && adapter.RequiresFormTag)
                {
                    return true;
                }
            }
            else if (!(control is UserControl) &&
                     !(control is LiteralControl))
            {
                // UserControl simply acts as a container, so the checking
                // should be delegated to its children below.
                // LiteralControl is a plain text control.  Also, it is
                // generated for the spaces in between mobile control tags so
                // we don't want to consider it as a form required control.
                // For other cases, we should generate form tag as we don't
                // know the content that will be generated.
                return true;
            }

            // No problem with the current control so far, now recursively
            // check its children.
            if (control.HasControls())
            {
                foreach (Control child in control.Controls)
                {
                    if (IsFormTagNeeded(child))
                    {
                        // This is to get out of recursive loop without
                        // further checking on other controls.
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:57,代码来源:ChtmlFormAdapter.cs

示例2: SavePrivateViewStateRecursive

 private void SavePrivateViewStateRecursive(Control control)
 {
     if (control.HasControls())
     {
         IEnumerator e = control.Controls.GetEnumerator();
         while (e.MoveNext())
         {
             MobileControl c = e.Current as MobileControl;
             if (c != null)
             {
                 c.SavePrivateViewStateInternal();
                 SavePrivateViewStateRecursive(c);
             }
             else
             {
                 SavePrivateViewStateRecursive((Control)e.Current);
             }
         }
     }
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:20,代码来源:MobilePage.cs

示例3: SetControlPageRecursive

 //identical to method in htmlformadapter
 private static void SetControlPageRecursive(Control control, int page)
 {
     MobileControl mc = control as MobileControl;
     if(mc != null)
     {
         mc.FirstPage = page;
         mc.LastPage = page;
     }
     if (control.HasControls())
     {
         foreach (Control child in control.Controls)
         {
             MobileControl mobileChild = child as MobileControl;
             if (mobileChild != null)
             {
                     mobileChild.FirstPage = page;
                     mobileChild.LastPage = page;
             }
             else 
             {
                 SetControlPageRecursive(child, page);
             }
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:WmlFormAdapter.cs

示例4: BuildControlPostBacksRecursive

        private void BuildControlPostBacksRecursive(Control control)
        {
            if (control is IPostBackDataHandler
                && !(control is IPostBackEventHandler)
                && control.Visible && control != Control)
            {
                MobileControl mobileCtl = control as MobileControl;

                if (mobileCtl != null && !mobileCtl.IsVisibleOnPage(Control.CurrentPage))
                {
                    String s = GetControlPostBackValue(mobileCtl);
                    if (s != null)
                    {
                        _postBackVariables[control] = s;
                    }
                }
                else
                {
                    _postBackVariables[control] = null;
                }
            }

            if (control.HasControls())
            {
                foreach (Control child in control.Controls)
                {
                    BuildControlPostBacksRecursive(child);
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:30,代码来源:WmlFormAdapter.cs

示例5: DoPaginateChildren

        //*********************************************************************
        //
        // MultiPanel.DoPaginateRecursive Static Method
        //
        // The DoPaginateRecursive method paginates non-mobile child
        // controls, looking for mobile controls inside them.
        //
        //*********************************************************************
        private static void DoPaginateChildren(ControlPager pager, Control ctl, ref int firstAssignedPage)
        {
            // Search all children of the control.
            if (ctl.HasControls())
            {
                foreach (Control child in ctl.Controls)
                {
                    if (child.Visible)
                    {
                        // Look for a visible mobile control.
                        MobileControl mobileCtl = child as MobileControl;
                        if (mobileCtl != null)
                        {
                            // Paginate the mobile control.
                            mobileCtl.PaginateRecursive(pager);

                            // If this is the first control being paginated,
                            // set the first assigned page.
                            if (firstAssignedPage == -1)
                            {
                                firstAssignedPage = mobileCtl.FirstPage;
                            }
                        }
                        else if (child is UserControl)
                        {
                            // Continue paginating user controls, which may contain
                            // their own mobile children.
                            DoPaginateChildren(pager, child, ref firstAssignedPage);
                        }
                    }
                }
            }
        }
开发者ID:pdckxd,项目名称:bugtrackingsystem,代码行数:41,代码来源:MobileControls.cs

示例6: RenderOffPageVariables

        // Renders hidden variables for IPostBackDataHandlers which are
        // not displayed due to pagination or secondary UI.
        internal void RenderOffPageVariables(HtmlMobileTextWriter writer, Control ctl, int page)
        {
            if (ctl.HasControls())
            {
                foreach (Control child in ctl.Controls)
                {
                    // Note: Control.Form != null.
                    if (!child.Visible || child == Control.Form.Header || child == Control.Form.Footer)
                    {
                        continue;
                    }

                    MobileControl mobileCtl = child as MobileControl;

                    if (mobileCtl != null)
                    {
                        if (mobileCtl.IsVisibleOnPage(page)
                            && (mobileCtl == ((HtmlFormAdapter)mobileCtl.Form.Adapter).SecondaryUIControl ||
                            null == ((HtmlFormAdapter)mobileCtl.Form.Adapter).SecondaryUIControl))
                        {
                            if (mobileCtl.FirstPage == mobileCtl.LastPage)
                            {
                                // Entire control is visible on this page, so no need to look
                                // into children.
                                continue;
                            }

                            // Control takes up more than one page, so it may be possible that
                            // its children are on a different page, so we'll continue to
                            // fall through into children.
                        }
                        else if (mobileCtl is IPostBackDataHandler)
                        {
                            HtmlControlAdapter adapter = mobileCtl.Adapter as HtmlControlAdapter;
                            if (adapter != null)
                            {
                                adapter.RenderAsHiddenInputField(writer);
                            }
                        }
                    }

                    RenderOffPageVariables(writer, child, page);
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:47,代码来源:HtmlControlAdapter.cs


注:本文中的Control.HasControls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。