• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UI.ControlCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ControlCollection类属于System.Web.UI命名空间,在下文中一共展示了ControlCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: BuildExportControls

        public void BuildExportControls(ControlCollection controls, System.Web.UI.Page page)
        {
            if (controls == null) 
                throw new ArgumentNullException("controls");
            if (page == null) 
                throw new ArgumentNullException("page");

            var isMessageAdded = controls.Contains(ErrorMessage);
            if (!isMessageAdded)
            {
                controls.Add(ErrorMessage);
                controls.Add(FeedbackMessage);
            }
                

            CurrentColllection = controls;

            ExportButton = UIControls.CreateExportPortletButton();
            ExportButton.Click += new EventHandler(ExportButton_Click);

            PortletList = GetPortletList(page);

            var exportPanel = new Panel();
            exportPanel.ID = "ExportControlPanels";
            exportPanel.GroupingText = "Export";


            exportPanel.Controls.Add(UIControls.CreateLineBreak());
            exportPanel.Controls.Add(PortletList);
            exportPanel.Controls.Add(ExportButton);

            controls.Add(exportPanel);
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:33,代码来源:ImportExportControlFacade.cs


示例2: LimpiarControles

 public void LimpiarControles(ControlCollection controles)
 {
     foreach (Control control in controles)
     {
         if (control is TextBox)
         {
             ((TextBox)control).Text = string.Empty;
         }
         else if (control is DropDownList)
         {
             ((DropDownList)control).ClearSelection();
         }
         else if (control is RadioButtonList)
             ((RadioButtonList)control).ClearSelection();
         else if (control is CheckBoxList)
             ((CheckBoxList)control).ClearSelection();
         else if (control is RadioButton)
             ((RadioButton)control).Checked = false;
         else if (control is CheckBox)
             ((CheckBox)control).Checked = false;
         else if (control is GridView)
             ((GridView)control).DataBind();
         else if (control.HasControls())
             //Esta linea detécta un Control que contenga otros Controles
             //Así ningún control se quedará sin ser limpiado.
             LimpiarControles(control.Controls);
     }
 }
开发者ID:Jaimeeag,项目名称:indraServer,代码行数:28,代码来源:Recursos.cs


示例3: BuildImportControls

        public void BuildImportControls(ControlCollection controls, System.Web.UI.Page page)
        {
            if (controls == null)
                throw new ArgumentNullException("controls");
            if (page == null) 
                throw new ArgumentNullException("page");

            var isMessageAdded = controls.Contains(ErrorMessage);
            if (!isMessageAdded)
            {
                controls.Add(ErrorMessage);
                controls.Add(FeedbackMessage);
            }
            CurrentColllection = controls;

            ImportButton = UIControls.CreateImportButton();
            ImportButton.Click += new EventHandler(ImportButton_Click);

            ImportTextBox = UIControls.CreateImportTextArea();
            ImportZoneList = GetZoneList(page);

            var importPanel = new Panel();
            importPanel.ID = "ImportControlsPanel";
            importPanel.GroupingText = "Import";


            importPanel.Controls.Add(UIControls.CreateLineBreak());
            importPanel.Controls.Add(ImportZoneList);
            importPanel.Controls.Add(UIControls.CreateLineBreak());
            importPanel.Controls.Add(ImportTextBox);
            importPanel.Controls.Add(UIControls.CreateLineBreak());
            importPanel.Controls.Add(ImportButton);
            controls.Add(importPanel);
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:34,代码来源:ImportExportControlFacade.cs


示例4: InsertOnLoadCode

 public static void InsertOnLoadCode(ControlCollection controls, string method)
 {
     foreach (Control control in controls)
      {
     LiteralControl literal = control as LiteralControl;
     if (literal != null)
     {
        int bodyPos = literal.Text.IndexOf(bodyTag);
        if (bodyPos > -1)
        {
           int onloadPos = literal.Text.IndexOf(onloadScript, bodyPos);
           if (onloadPos > -1)
           {
              literal.Text = literal.Text.Insert(onloadPos + onloadScript.Length, method);
           }
           else
           {
              literal.Text =
                 literal.Text.Insert(bodyPos + bodyTag.Length, string.Format(" onload='{0}'", method));
           }
           break;
        }
     }
      }
 }
开发者ID:Refactored,项目名称:SitecoreCalendarModule,代码行数:25,代码来源:WebUtilities.cs


示例5: GetOrCreateTest

        /// <summary>
        /// Create a new test, or load an existing one.
        /// </summary>
        /// <param name="testName"></param>
        /// <param name="alternatives"></param>
        /// <returns></returns>
        public Experiment GetOrCreateTest(string testName, ControlCollection alternatives)
        {
            SerializableDictionary<string, Experiment> tests = GetTests();
            Experiment test;
            if (tests.ContainsKey(testName))
            {
                test = tests[testName];
            }
            else
            {
                string[] altNames = new string[alternatives.Count];
                for (int a = 0; a < alternatives.Count; a++)
                {
                    Alternative alt = (Alternative)alternatives[a];
                    if (!String.IsNullOrEmpty(alt.Name))
                    {
                        altNames[a] = alt.Name;
                    }
                    else
                    {
                        altNames[a] = "Alternative " + (a + 1);
                    }
                }

                test = new Experiment(testName, altNames);
                tests.Add(testName, test);

                SaveTests(tests);
            }

            return test;
        }
开发者ID:colefichter,项目名称:ABTesting,代码行数:38,代码来源:FairlyCertain.cs


示例6: SetEmptyFormControls

 public static void SetEmptyFormControls(ControlCollection ChildCtrls)
 {
     foreach (Control Ctrl in ChildCtrls)
     {
         if (Ctrl is TextBox)
             ((TextBox)Ctrl).Text = string.Empty;
         else if (Ctrl is RadComboBox)
             ((RadComboBox)Ctrl).SelectedValue = string.Empty;
         else if (Ctrl is Label)
             ((Label)Ctrl).Text = string.Empty;
         else if (Ctrl is RadNumericTextBox)
             ((RadNumericTextBox)Ctrl).Text = string.Empty;
         else if (Ctrl is RadMaskedTextBox)
             ((RadMaskedTextBox)Ctrl).Text = string.Empty;
         else if (Ctrl is RadTextBox)
             ((RadTextBox)Ctrl).Text = string.Empty;
         else if (Ctrl is RadDatePicker)
             ((RadDatePicker)Ctrl).SelectedDate = null;
         else if (Ctrl is VVTextBox)
             ((VVTextBox)Ctrl).SetTextDefault("");
         else if (Ctrl is VVNumberBox)
             ((VVNumberBox)Ctrl).SetTextDefault("");
         else if (Ctrl is VVDatePicker)
             ((VVDatePicker)Ctrl).SetTextDefault("");
         else
             SetEmptyFormControls(Ctrl.Controls);
     }
 }
开发者ID:nguyenppt,项目名称:1pubcreditnew,代码行数:28,代码来源:Commont.cs


示例7: GetControls

        public override ControlCollection GetControls(DataGridCommandEventArgs e)
        {
            DataGrid grid = Grid;
            ControlCollection controls = new ControlCollection(grid);
            foreach (TableCell cell in e.Item.Cells)
            {
                for (int i = 0; i < cell.Controls.Count; i++)
                    controls.Add(cell.Controls[i]);
            }

            /*
            // What the scripts usually do, but our EDITOR_CELL is null.
            const int EDITOR_CELL = 8;
            TableCell o = e.Item.Cells[EDITOR_CELL];
            DropDownList r = (DropDownList) o.FindControl(App.EDITOR);
            controls.Add(r);
            object o = e.Item.FindControl(App.EDITOR);

            // The template is in the DataGrid, just not in the event
            TableRow item = grid.Items[1];
            foreach (TableCell cell in item.Cells)
            {
                for (int i = 0; i < cell.Controls.Count; i++)
                    controls.Add(cell.Controls[i]);
            }
            */

            return controls;
        }
开发者ID:benouarred,项目名称:struts-archive,代码行数:29,代码来源:Lister2.ascx.cs


示例8: FindProperlyPosition

        /// <summary>
        /// 找一个合适的位置来放置样式表。
        /// </summary>
        /// <param name="controls">来自Header.Controls</param>
        /// <returns></returns>
        /// <remarks>
        /// CSS样式表通常有特定的加载顺序。为了防止css顺序混乱,需要采取一些特殊手法。
        /// 原则:1、建议link引用样式表应出现在任何title和meta元素之后。
        /// 2、必须首先加载的样式表,请为link使用topmost=""属性,并且顺序出现,不能间隔。
        /// 3、任何style和script元素应出现在link元素之后。
        /// </remarks>
        private static int FindProperlyPosition(ControlCollection controls)
        {
            int k = 0;
            Control ctrl;
            for (; k < controls.Count; k++)
            {
                ctrl = controls[k];
                if (ctrl is HtmlLink)
                {
                    HtmlLink link = (HtmlLink)ctrl;
                    if (string.Compare(link.Attributes["rel"], "stylesheet", true) == 0 || ((HtmlLink)ctrl).Attributes["type"] == "text/css")
                    {
                        if (link.Attributes["topmost"] == null)
                        {
                            break;
                        }
                    }
                }
                else if (ctrl is LiteralControl && (System.Text.RegularExpressions.Regex.IsMatch(((LiteralControl)ctrl).Text, "<script ") || System.Text.RegularExpressions.Regex.IsMatch(((LiteralControl)ctrl).Text, "<style ")))
                {
                    break;
                }
            }

            return k;
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:37,代码来源:ClientCssManager.cs


示例9: beforTest

 public void beforTest()
 {
     mockery = new Mockery();
     view = mockery.NewMock<IKeyboardView>();
     presenter = new KeyboardPresenter(view);
     keypad = new ControlCollection(new Panel());
     configuration = new Dictionary<string, bool>();
 }
开发者ID:bjornebjornson,项目名称:Gema2008,代码行数:8,代码来源:KeyboardPresenter_Fixture.cs


示例10: InitBookmarkingPage

        public static void InitBookmarkingPage(ControlCollection c)
        {
            var provider = new BookmarkingScriptProvider();

            BookmarkingSettings.ModuleId = BookmarkingConst.BookmarkingId;

            c.Add(provider);
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:8,代码来源:BookmarkingNavigationUtil.cs


示例11: SetBookmarkingActions

 public static void SetBookmarkingActions(ControlCollection c)
 {
     var actions = GetBookmarkingActions();
     if (0 < actions.Controls.Count)
     {
         c.Add(actions);
     }
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:8,代码来源:BookmarkingNavigationUtil.cs


示例12: SetBookmarkInfoActionsAndNavigation

 public static void SetBookmarkInfoActionsAndNavigation(ControlCollection c)
 {
     var actions = GetBookmarkInfoActions();
     if (0 < actions.Controls.Count)
     {
         c.Add(actions);
     }
     SetBookmarkingNavigation(c);
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:9,代码来源:BookmarkingNavigationUtil.cs


示例13: UpdateBreadCrumb

		public static bool UpdateBreadCrumb(ControlCollection ctrls, string ForumBread)
		{
			if (string.IsNullOrEmpty(ForumBread))
			{
				return true;
			}
			string[] bcText = ForumBread.Split('|');
			try
			{
				foreach (Control ctrl in ctrls)
				{
					if (ctrl is DotNetNuke.UI.Skins.SkinObjectBase && ctrl.TemplateControl.AppRelativeVirtualPath != null)
					{
						if (ctrl.TemplateControl.AppRelativeVirtualPath.ToLowerInvariant().Contains("breadcrumb.ascx"))
						{
							object o = ctrl.GetType().GetProperty("Separator").GetValue(ctrl, BindingFlags.Public | BindingFlags.NonPublic, null, null, null);
							object cssObject = ctrl.GetType().GetProperty("CssClass").GetValue(ctrl, BindingFlags.Public | BindingFlags.NonPublic, null, null, null);
							string css = "SkinObject";
							if (cssObject != null)
							{
								if (! (string.IsNullOrEmpty(cssObject.ToString())))
								{
									css = cssObject.ToString();
								}
							}
                            string sText = string.Empty;
                            if (o != null)
                            {
                                sText = o.ToString();
                            }
							
							string sBread = string.Empty;
							foreach (string s in bcText)
							{
								if (! (string.IsNullOrEmpty(s)))
								{
									var newValue = s.Replace("<a ", "<a class=\"" + css + "\" ");
                                    sBread += sText + newValue;
								}
							}
							((System.Web.UI.WebControls.Label)(ctrl.FindControl("lblBreadCrumb"))).Text += sBread;
							break;
						}
					}
					if (ctrl.Controls.Count > 0)
					{
						UpdateBreadCrumb(ctrl.Controls, ForumBread);
					}
				}
				return true;
			}
			catch (Exception ex)
			{
				return false;
			}
		}
开发者ID:allanedk,项目名称:ActiveForums,代码行数:56,代码来源:Environment.cs


示例14: GenerateFieldList

        public static DataTable GenerateFieldList(ControlCollection controls)
        {
            DataTable data = new DataTable();
            data.Columns.Add("Field_ID");
            data.Columns.Add("Field_Value");

            foreach (Control control in (ControlCollection)controls)
            {
                if (control.GetType() == typeof(PlaceHolder))
                {
                    PlaceHolder ph = (PlaceHolder)control;

                    foreach (Control phc in ph.Controls)
                    {
                        DataRow dr = data.NewRow();

                        string test = typeof(CrossBrowser_TextBox).ToString();

                        //if (phc.GetType() == typeof(TextBox))
                        if (phc.GetType().ToString() == "ASP.controls_crossbrowser_textbox_ascx")
                        {
                            TextBox tb = ((CrossBrowser_TextBox)phc).tbxCrossBrowser;
                            dr["Field_ID"] = tb.ID;
                            dr["Field_Value"] = tb.Text;
                        }
                        else if (phc.GetType().ToString() == "ASP.controls_crossbrowser_textarea_ascx")
                        {
                            TextBox tb = ((CrossBrowser_TextArea)phc).tbxCrossBrowser;
                            dr["Field_ID"] = tb.ID;
                            dr["Field_Value"] = tb.Text;
                        }
                        else if (phc.GetType() == typeof(DropDownList))
                        {
                            DropDownList ddl = (DropDownList)phc;
                            dr["Field_ID"] = ddl.ID;
                            dr["Field_Value"] = ddl.Text;
                        }
                        else if (phc.GetType() == typeof(ListBox))
                        {
                            ListBox lb = (ListBox)phc;
                            dr["Field_ID"] = lb.ID;

                            foreach (ListItem li in lb.Items)
                            {
                                if(li.Selected)
                                    dr["Field_Value"] += li.Text + ",";
                            }
                        }

                        data.Rows.Add(dr);
                    }
                }
            }

            return data;
        }
开发者ID:jpesquibel,项目名称:Projects,代码行数:56,代码来源:FormGeneratorTools.cs


示例15: MoveControls

 /// <summary>
 /// Moves controls from one control collection to the other.
 /// </summary>
 /// <param name="source">Source control collection. Will be
 /// emptied.</param>
 /// <param name="target">Target collection to be filled.</param>
 public static void MoveControls(ControlCollection source, ControlCollection target)
 {
     int count = source.Count;
       for (int i=0; i<count; i++)
       {
     Control ctrl = source[0];
     source.RemoveAt(0);
     target.Add(ctrl);
       }
 }
开发者ID:skitsanos,项目名称:WDK9,代码行数:16,代码来源:ControlUtil.cs


示例16: BuildUpControls

        public static CompositionBatch BuildUpControls(CompositionBatch batch, ControlCollection controls)
        {
            foreach (Control c in controls)
            {
                batch = ComposeWebPartsUtils.BuildUp(batch, c);
                batch = BuildUpControls(batch, c.Controls);
            }

            return batch;
        }
开发者ID:femiosinowo,项目名称:sssadl,代码行数:10,代码来源:ComposeWebPartsUtils.cs


示例17: ApplyCssClass

        private void ApplyCssClass(ControlCollection controls)
        {
            foreach (Control control in controls)
            {
                if (control is TextBox)
                    ((TextBox)control).CssClass = TextBoxCssClass;

                ApplyCssClass(control.Controls);
            }
        }
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:10,代码来源:EntityFormPasswordItem.cs


示例18: ApplyCssClass

        private void ApplyCssClass(ControlCollection controls)
        {
            foreach (Control control in controls)
            {
                if (control is Button)
                    ((Button)control).CssClass = ButtonCssClass;

                ApplyCssClass(control.Controls);
            }
        }
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:10,代码来源:EntityFormButtonsItem.cs


示例19: LimpiarControles

 protected void LimpiarControles(ControlCollection cc)
 {
     foreach (Control c in cc)
     {
         if (c is System.Web.UI.WebControls.TextBox)
             (c as TextBox).Text = String.Empty;
         else if (c.Controls.Count > 0)
             LimpiarControles(c.Controls);
     }
 }
开发者ID:arzafran,项目名称:Subibaje,代码行数:10,代码来源:Pagina.cs


示例20: GetCustomServerButtons

 /// <summary>
 /// 获取自定义服务器控件
 /// <remarks>存放于_rightControls中</remarks>
 /// </summary>
 /// <param name="cc"></param>
 private void GetCustomServerButtons(ControlCollection cc)
 {
     foreach (Control c in cc)
     {
         if (c is ICustomControl)
             _rightControls.Add(c);
         else if (c.HasControls())
             GetCustomServerButtons(c.Controls);
     }
 }
开发者ID:joyhen,项目名称:mywork,代码行数:15,代码来源:PageUI.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UI.DataSourceSelectArguments类代码示例发布时间:2022-05-26
下一篇:
C# UI.ControlBuilder类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap