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


C# ControlCollection.Remove方法代码示例

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


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

示例1: Deny_Unrestricted

		public void Deny_Unrestricted ()
		{
			// note: using the same control (as owner) to add results 
			// in killing the ms runtime with a stackoverflow - FDBK36722
			ControlCollection cc = new ControlCollection (new Control ());
			Assert.AreEqual (0, cc.Count, "Count");
			Assert.IsFalse (cc.IsReadOnly, "IsReadOnly");
			Assert.IsFalse (cc.IsSynchronized, "IsSynchronized");
			Assert.IsNotNull (cc.SyncRoot, "SyncRoot");

			cc.Add (control);
			Assert.IsNotNull (cc[0], "this[int]");
			cc.Clear ();
			cc.AddAt (0, control);
			Assert.IsTrue (cc.Contains (control), "Contains");

			cc.CopyTo (new Control[1], 0);
			Assert.IsNotNull (cc.GetEnumerator (), "GetEnumerator");
			Assert.AreEqual (0, cc.IndexOf (control), "IndexOf");
			cc.RemoveAt (0);
			cc.Remove (control);
		}
开发者ID:nobled,项目名称:mono,代码行数:22,代码来源:ControlCollectionCas.cs

示例2: RemoveProblemTypes

        static public void RemoveProblemTypes(ControlCollection coll, List<ControlRestorationInfo> stashedControls)
        {
            foreach (Control ctrl in coll)
            {
                if (typeof(RequiredFieldValidator).IsAssignableFrom(ctrl.GetType()) ||
                    typeof(CompareValidator).IsAssignableFrom(ctrl.GetType()) ||
                    typeof(RegularExpressionValidator).IsAssignableFrom(ctrl.GetType()) ||
                    typeof(ValidationSummary).IsAssignableFrom(ctrl.GetType()))
                {
                    ControlRestorationInfo cri = new ControlRestorationInfo(ctrl, coll);
                    stashedControls.Add(cri);
                    coll.Remove(ctrl);
                    continue;
                }

                if (ctrl.HasControls())
                {
                    RemoveProblemTypes(ctrl.Controls, stashedControls);
                }
            }
        }
开发者ID:tmthang-bi,项目名称:BrokerManager,代码行数:21,代码来源:WebControlAdapterExtender.cs

示例3: HandleControls

        /// <summary>
        /// Moves all templated controls of a given region provider
        /// into their target regions.
        /// </summary>
        /// <param name="template">The template to be used.</param>
        /// <param name="controls">Controls to move into the template.</param>
        /// <param name="provider">Provides region assignements for the controls.</param>
        /// <param name="page">The currently rendered page.</param>
        protected static void HandleControls(IPortalTemplate template, RegionProvider provider, ControlCollection controls, Page page)
        {
            //force template control creation now by adding / removing the template
              Control templateControl = (Control)template;
              controls.Add(templateControl);
              controls.Remove(templateControl);

              //call initialization code of the template
              template.BeforeTemplating(page);

              //add defined controls to their target region
              RegionPlaceHolder placeHolder;
              foreach (RegionPropertySet propertySet in provider)
              {
            placeHolder = template[propertySet.TargetRegion];
            if (placeHolder == null)
            {
              string msg = "Invalid region defined for control {0}. Template does not contain region '{1}'";
              msg = String.Format(msg, propertySet.Control.ID, propertySet.TargetRegion);
              throw new ArgumentException(msg);
            }

            //remove templated control from original location...
            controls.Remove(propertySet.Control);
            //...and put it into placeholder
            placeHolder.Controls.Add(propertySet.Control);
              }

              //add remaining controls to default region, if any
              if (provider.DefaultRegion != PortalRegion.None)
              {
            placeHolder = template[provider.DefaultRegion];
            if (placeHolder == null)
            {
              string msg = "Invalid default region defined: Template does not contain region '{0}'";
              msg = String.Format(msg, provider.DefaultRegion);
              throw new ArgumentException(msg);
            }

            //move remaining controls into the template's controls
            ControlUtil.MoveControls(controls, placeHolder.Controls);
              }

              //Everything is now in the template. Now move all the template's
              //controls back into the page's control collection. This is necessary
              //to keep relative links of the web form working
              ControlUtil.MoveControls(templateControl.Controls, controls);

              //call initialization code of the template
              template.AfterTemplating(page);
        }
开发者ID:skitsanos,项目名称:WDK9,代码行数:59,代码来源:TemplateRenderer.cs


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