Пример #1
0
 protected override void OnDayRender(ASP.TableCell cell, ASP.CalendarDay day) {
     base.OnDayRender(cell, day);
     if (this.mouseOverStyle != null && !day.IsSelected) {
         cell.Attributes.Add("onmouseover", Utils.GetJavaScriptStyleString(this.mouseOverStyle));
         cell.Attributes.Add("onmouseout", Utils.GetJavaScriptStyleString(cell.ControlStyle));
     }
 }
Пример #2
0
 private string GetHobbies(AspNet.CheckBoxList cblHobby)
 {
     StringBuilder sb = new StringBuilder();
     foreach (AspNet.ListItem item in cblHobby.Items)
     {
         if (item.Selected)
         {
             switch (item.Value)
             {
                 case "reading":
                     sb.Append("读书,");
                     break;
                 case "basketball":
                     sb.Append("篮球,");
                     break;
                 case "travel":
                     sb.Append("旅游,");
                     break;
                 case "movie":
                     sb.Append("电影,");
                     break;
                 case "music":
                     sb.Append("音乐,");
                     break;
             }
         }
     }
     return sb.ToString().TrimEnd(',');
 }
Пример #3
0
        void TopicBody_ItemDataBound(object sender, ASP.RepeaterItemEventArgs e)
        {
            var replyLink = e.Item.FindControl("ReplyLink") as ActionLinkButton;

            if (replyLink == null)
                return;

            replyLink.ActionName = "Add";
            replyLink.NodePath = ContextElement.Path;
            replyLink.Parameters = new { ReplyTo = ((Content)e.Item.DataItem).Path };
        }
Пример #4
0
		/// <summary>
		/// Adds the script to the item's attribute collection.
		/// </summary>
		/// <param name="control">The control to modify.</param>
		/// <param name="item">The <see cref="System.Web.UI.WebControls.ListItem"/> to modify.</param>
		/// <param name="attributeName">The attribute to modify.</param>
		/// <param name="script">The script to add.</param>
		public static void AddScriptAttribute(ASP.WebControl control, ASP.ListItem item, string attributeName, string script)
		{
			bool enableCallBack = !(control is ICallbackControl) || ((ICallbackControl)control).EnableCallBack;

			if(enableCallBack)
			{
				string newValue = script;
				string oldValue = (item == null) ? control.Attributes[attributeName] : item.Attributes[attributeName];

				// Append the new script to the old (if one existed)
				if(oldValue != null && oldValue != newValue) newValue = oldValue.Trim().TrimEnd(';') + ";" + script;

				if(item == null)
					control.Attributes[attributeName] = newValue;
				else
					item.Attributes[attributeName] = newValue;
			}
		}
Пример #5
0
		/// <summary>
		/// Adds the <strong>onclick</strong> attribute to each item to invoke a callback from the client, 
		/// then renders the item.
		/// </summary>
		protected override void RenderItem(ASP.ListItemType itemType, int repeatIndex, ASP.RepeatInfo repeatInfo, HtmlTextWriter writer)
		{
			if(AutoCallBack)
			{
				ASP.ListItem item = this.Items[repeatIndex];
				if(item.Selected)
				{
					item.Attributes.Remove("onclick");
				}
				else
				{
					item.Attributes["onclick"] = EventHandlerManager.GetCallbackEventReference(
						this,
						repeatIndex.ToString(),
						this.CausesValidation,
						this.ValidationGroup
					);
				}
			}

			base.RenderItem(itemType, repeatIndex, repeatInfo, writer);
		}
Пример #6
0
		/// <summary>
		///		Compare two strings using the type and operator
		/// </summary>
		/// <param name="leftText"></param>
		/// <param name="cultureInvariantLeftText"></param>
		/// <param name="rightText"></param>
		/// <param name="cultureInvariantRightText"></param>
		/// <param name="op"></param>
		/// <param name="type"></param>
		/// <returns></returns>
		protected static bool Compare(string leftText, bool cultureInvariantLeftText, string rightText, bool cultureInvariantRightText, WebControls.ValidationCompareOperator op, WebControls.ValidationDataType type)
		{
			object leftObject;
			if (!Convert(leftText, type, cultureInvariantLeftText, out leftObject)) return false;

			if (op == WebControls.ValidationCompareOperator.DataTypeCheck) return true;

			object rightObject;
			if (!Convert(rightText, type, cultureInvariantRightText, out rightObject)) return true;

			int compareResult;
			switch (type) {
				case WebControls.ValidationDataType.String:
					compareResult = String.Compare((string)leftObject, (string)rightObject, false, CultureInfo.CurrentCulture);
					break;
				case WebControls.ValidationDataType.Integer:
					compareResult = ((int)leftObject).CompareTo(rightObject);
					break;
				case WebControls.ValidationDataType.Double:
					compareResult = ((double)leftObject).CompareTo(rightObject);
					break;
				case WebControls.ValidationDataType.Date:
					compareResult = ((DateTime)leftObject).CompareTo(rightObject);
					break;
				case WebControls.ValidationDataType.Currency:
					compareResult = ((Decimal)leftObject).CompareTo(rightObject);
					break;
				default:
					Debug.Fail("Unknown Type");
					return true;
			}
			switch (op) {
				case WebControls.ValidationCompareOperator.Equal:
					return compareResult == 0;
				case WebControls.ValidationCompareOperator.NotEqual:
					return compareResult != 0;
				case WebControls.ValidationCompareOperator.GreaterThan:
					return compareResult > 0;
				case WebControls.ValidationCompareOperator.GreaterThanEqual:
					return compareResult >= 0;
				case WebControls.ValidationCompareOperator.LessThan:
					return compareResult < 0;
				case WebControls.ValidationCompareOperator.LessThanEqual:
					return compareResult <= 0;
				default:
					Debug.Fail("Unknown Operator");
					return true;
			}
		}
Пример #7
0
		/// <summary>
		///		Converts a culture invariant to a current culture format.
		/// </summary>
		/// <param name="valueInString"></param>
		/// <param name="type"></param>
		/// <returns></returns>
		internal string ConvertCultureInvariantToCurrentCultureFormat(string valueInString, WebControls.ValidationDataType type)
		{
			object value;
			Convert(valueInString, type, true, out value);
			return
				value is DateTime
					// For Date type we explicitly want the date portion only
					? ((DateTime)value).ToShortDateString()
					: System.Convert.ToString(value, CultureInfo.CurrentCulture);
		}
Пример #8
0
		/// <summary>
		///		Try to convert the test into the validation data type
		/// </summary>
		/// <param name="text"></param>
		/// <param name="type"></param>
		/// <param name="cultureInvariant"></param>
		/// <param name="value"></param>
		/// <returns></returns>
		protected static bool Convert(string text, WebControls.ValidationDataType type, bool cultureInvariant, out object value)
		{
			value = null;
			try {
				switch (type) {
					case WebControls.ValidationDataType.String:
						value = text;
						break;
					case WebControls.ValidationDataType.Integer:
						value = Int32.Parse(text, CultureInfo.InvariantCulture);
						break;
					case WebControls.ValidationDataType.Double: {
							string cleanInput;
							if (cultureInvariant)
								cleanInput = ConvertDouble(text, CultureInfo.InvariantCulture.NumberFormat);
							else
								cleanInput = ConvertDouble(text, NumberFormatInfo.CurrentInfo);

							if (cleanInput != null)
								value = Double.Parse(cleanInput, CultureInfo.InvariantCulture);
							break;
						}
					case WebControls.ValidationDataType.Date: {
							if (cultureInvariant)
								value = ConvertDate(text, "ymd");
							else {
								// if the calendar is not gregorian, we should not enable client-side, so just parse it directly:
								if (!(DateTimeFormatInfo.CurrentInfo.Calendar.GetType() == typeof(GregorianCalendar))) {
									value = DateTime.Parse(text, CultureInfo.CurrentCulture);
									break;
								}

								string dateElementOrder = GetDateElementOrder();
								value = ConvertDate(text, dateElementOrder);
							}
							break;
						}
					case WebControls.ValidationDataType.Currency: {
							string cleanInput;
							if (cultureInvariant)
								cleanInput = ConvertCurrency(text, CultureInfo.InvariantCulture.NumberFormat);
							else
								cleanInput = ConvertCurrency(text, NumberFormatInfo.CurrentInfo);

							if (cleanInput != null)
								value = Decimal.Parse(cleanInput, CultureInfo.InvariantCulture);
							break;
						}
				}
			}
			catch {
				value = null;
			}
			return (value != null);
		}
Пример #9
0
		/// <summary>
		///		Compare two strings using the type and operator
		/// </summary>
		/// <param name="leftText"></param>
		/// <param name="rightText"></param>
		/// <param name="op"></param>
		/// <param name="type"></param>
		/// <returns></returns>
		protected static bool Compare(string leftText, string rightText, WebControls.ValidationCompareOperator op, WebControls.ValidationDataType type)
		{
			return Compare(leftText, false, rightText, false, op, type);
		}
Пример #10
0
 public GridViewRowClickEventArgs(ASP.GridViewRow row, string commandName, string commandArgument) {
     this.commandName = commandName;
     this.commandArgument = commandArgument;
     this.row = row;
 }
Пример #11
0
		/// <summary>
		/// Adds the script to the control's attribute collection.
		/// </summary>
		/// <remarks>
		/// If the attribute already exists, the script is prepended to the existing value.
		/// </remarks>
		/// <param name="control">The control to modify.</param>
		/// <param name="attributeName">The attribute to modify.</param>
		/// <param name="script">The script to add to the attribute.</param>
		public static void AddScriptAttribute(ASP.WebControl control, string attributeName, string script)
		{
			AddScriptAttribute(control, null, attributeName, script);
		}
Пример #12
0
 /// <summary>
 /// Excecutes <see cref="System.Web.UI.WebControls.DataList.OnCancelCommand"/>, 
 /// then sets <see cref="UpdateAfterCallBack"/> to true.
 /// </summary>
 protected override void OnCancelCommand(ASP.DataListCommandEventArgs e)
 {
     base.OnCancelCommand(e);
     this.UpdateAfterCallBack = true;
 }
Пример #13
0
 //ASP.TableCell cell or ASP.GridViewRow row
 private void SetClickEvent(ASP.WebControl row, string commandName, string commandArgument) {
     if (!this.AddCallBacks) {
         string eventText = commandName + "$" + commandArgument;
         row.Attributes.Add("onclick", this.Page.ClientScript.GetPostBackEventReference(this, eventText));
     }
     else {
         string command = (String.IsNullOrEmpty(commandName) && String.IsNullOrEmpty(commandArgument) ? "" : commandName + "$" + commandArgument);
         string script = String.Format("Anthem_FireCallBackEvent(this,event,'{0}','{1}',{2},'{3}','','{4}',{5},{6},{7},{8},true,true);return false;",
                                       this.UniqueID,
                                       command,
                                       "false",
                                       String.Empty,
                                       base.TextDuringCallBack,
                                       base.EnabledDuringCallBack ? "true" : "false",
                                       (String.IsNullOrEmpty(base.PreCallBackFunction)  ? "null" : base.PreCallBackFunction),
                                       (String.IsNullOrEmpty(base.PostCallBackFunction) ? "null" : base.PostCallBackFunction),
                                       (String.IsNullOrEmpty(base.CallBackCancelledFunction) ? "null" : base.CallBackCancelledFunction));
         Manager.AddScriptAttribute(row, "onclick", script);
     }
 }
Пример #14
0
 private void SetSortHeaderAttributes(ASP.GridViewRowEventArgs e) {
     bool images = (this.AscImage != String.Empty && this.DescImage != String.Empty);
     for (int i = 0; i < e.Row.Cells.Count; i++) {
         ASP.TableCell td = e.Row.Cells[i];
         if (td.HasControls()) {
             ASP.LinkButton button = td.Controls[0] as ASP.LinkButton;
             if (button != null) {                        
                 if (this.SortExpression == button.CommandArgument) {
                     td.ApplyStyle(this.SortedColumnHeaderRowStyle);
                     this.sortColumnIndex = i;
                     if (images) {
                         ImageButton btn = new ImageButton();
                         btn.CommandName = button.CommandName;
                         btn.CommandArgument = button.CommandArgument;                                
                         btn.ImageUrl = (this.SortDirection == ASP.SortDirection.Ascending ? this.AscImage : this.DescImage);
                         td.Controls.Add(new LiteralControl("&nbsp;"));
                         td.Controls.Add(btn);
                         td.Controls.Add(new LiteralControl("&nbsp;"));
                     }
                 }
             }
         }
     }
 }
Пример #15
0
        /// <summary>
        /// called upon building the TreeView from the hierarchy table - creates a new Treenode and sets its parent to the "itme"
        /// </summary>
        /// <param name="row"></param>
        /// <param name="item"></param>
        private void AddSubtreeForItem(HierarchyRow row, WC.TreeNode item)
        {
            HierarchyRow[] children = row.GetHierarchyChildRows("Hierarchy");

            WC.TreeNode childItem;
            foreach (HierarchyRow child in children)
            {
                childItem = new WC.TreeNode(child.Caption, child.Id.ToString());
                item.ChildNodes.Add(childItem);
                AddSubtreeForItem(child, childItem);
            }
        }
Пример #16
0
 // use ref for some stupid reason even though a class passes by ref otherwise ASP compiler freaks! :P
 private void SetTableItemStyle(ref ASP.TableItemStyle style) {
     style = new ASP.TableItemStyle();
     if (base.IsTrackingViewState)
         ((IStateManager)style).TrackViewState();
 }
Пример #17
0
 protected override void InitializePager(ASP.GridViewRow row, int columnSpan, ASP.PagedDataSource pagedDataSource) {
     this.virtualItemCount = pagedDataSource.DataSourceCount;
     bool hide = (this.hidePagerOnOnePage && pagedDataSource.PageCount <= 1);
     if (!hide) {
         if (this.UseCoolPager) 
             this.CreateCoolPager(row, columnSpan, pagedDataSource);
         else
             base.InitializePager(row, columnSpan, pagedDataSource);
     }
 }
Пример #18
0
 protected override void OnRowCreated(ASP.GridViewRowEventArgs e) {
     base.OnRowCreated(e);
     if (e.Row != null) {
         switch (e.Row.RowType) {
             case ASP.DataControlRowType.Header  : this.SetSortHeaderAttributes(e); break;
             case ASP.DataControlRowType.DataRow :
                 if (this.sortColumnIndex > -1) {
                     ASP.TableCell td = e.Row.Cells[this.sortColumnIndex];
                     td.ApplyStyle(this.SortedColumnRowStyle);
                 }
                 break;
         }
     }
 }
Пример #19
0
		/// <summary>
		///		Determines whether the specified string can be converted to the specified data type. This version of the overloaded method tests currency, double, and date values using the format used by the current culture.
		/// </summary>
		/// <param name="text">The string to test.</param>
		/// <param name="type">One of the <see cref='System.Web.UI.WebControls.ValidationDataType'/> values.</param>
		/// <returns>true if the specified data string can be converted to the specified data type; otherwise, false.</returns>
		public static bool CanConvert(string text, WebControls.ValidationDataType type)
		{
			return CanConvert(text, type, false);
		}
Пример #20
0
        private void DetermineRowClickAction(ASP.GridViewRow row) {
            string commandName = null;
            string commandArg = null;
            switch (this.RowClickEvent) {
                case RowClickEvent.Click  :
                    commandName = "click";
                    commandArg = row.RowIndex.ToString();
                    break;
                    
                case RowClickEvent.Edit   :
                    commandName = "edit";
                    commandArg = row.RowIndex.ToString();
                    break;

                case RowClickEvent.Select :
                    commandName = "select";
                    commandArg = row.RowIndex.ToString();
                    break;
            }
            if (!Utils.ContainsControlType(row, NORENDER_CLICK_TYPES))
                this.SetClickEvent(row, commandName, commandArg); // set on tr
            else {
                foreach (ASP.TableCell cell in row.Cells)
                    if (!Utils.ContainsControlType(cell, NORENDER_CLICK_TYPES))
                        this.SetClickEvent(cell, commandName, commandArg);
            }
        }
Пример #21
0
		/// <summary>
		///		Determines whether the specified string can be converted to the specified data type. This version of the overloaded method allows you to specify whether values are tested using a culture-neutral format.
		/// </summary>
		/// <param name="text">The string to test.</param>
		/// <param name="type">One of the <see cref='System.Web.UI.WebControls.ValidationDataType'/> enumeration values.</param>
		/// <param name="cultureInvariant">true to test values using a culture-neutral format; otherwise, false.</param>
		/// <returns>true if the specified data string can be converted to the specified data type; otherwise, false.</returns>
		public static bool CanConvert(string text, WebControls.ValidationDataType type, bool cultureInvariant)
		{
			object value = null;
			return Convert(text, type, cultureInvariant, out value);
		}
Пример #22
0
		static Menu CreateMenuForRenderTests (MyWebControl.Adapters.MenuAdapter adapter)
		{
			return CreateMenuForRenderTests (adapter, true);
		}
Пример #23
0
        void CreatePanelHeading(WC.WebControl container)
        {
            WC.Panel heading = new WC.Panel();

            if (activePanel is MPanel)
            {
                Label panelName = new Label();
                panelName.CssClass = "panelHeading";
                panelName.Text = activePanel.panelName;
                heading.Controls.Add(panelName);
            }
            if (CE.GlobalState == GlobalState.Architect)
            {
                LinkButton editMenuLink = new LinkButton();
                editMenuLink.PostBackUrl = editMenuLink.GetRouteUrl("ArchitectEditMenuRoute", new { projectName = CE.project.Name });
                editMenuLink.Text = "Edit menu structure";
                editMenuLink.CausesValidation = false;
                heading.Controls.Add(editMenuLink);

                LinkButton editPanelsLink = new LinkButton();
                editPanelsLink.PostBackUrl = editPanelsLink.GetRouteUrl("ArchitectEditPanelsRoute", new { projectName = CE.project.Name });
                editPanelsLink.Text = "Edit panels structure";
                editPanelsLink.CausesValidation = false;
                heading.Controls.Add(editPanelsLink);

                if (activePanel is MPanel)
                {

                    if (activePanel.type == PanelTypes.Editable)
                    {
                        LinkButton editEditableLink = new LinkButton();
                        editEditableLink.PostBackUrl = editEditableLink.GetRouteUrl("ArchitectEditEditableRoute",
                            new { projectName = mm.ProjectName, panelid = Page.RouteData.Values["panelId"] });
                        editEditableLink.Text = "Edit panel structure";
                        editEditableLink.CausesValidation = false;
                        heading.Controls.Add(editEditableLink);
                    }
                    else
                    {
                        LinkButton editNavLink = new LinkButton();
                        editNavLink.PostBackUrl = editNavLink.GetRouteUrl("ArchitectEditNavRoute",
                            new { projectName = CE.project.Name, panelid = Page.RouteData.Values["panelId"] });
                        editNavLink.Text = "Edit panel structure";
                        editNavLink.CausesValidation = false;
                        heading.Controls.Add(editNavLink);
                    }
                }

                LinkButton reproposeLink = new LinkButton();
                reproposeLink.CausesValidation = false;
                reproposeLink.Click += Repropose_Click;
                reproposeLink.Text = "Repropose";
                reproposeLink.OnClientClick = "return confirm('Think twice')";
                heading.Controls.Add(reproposeLink);
            }

            heading.CssClass = "panelHeading";
            if (heading.Controls.Count > 0)
            {
                container.Controls.Add(heading);
                WC.Panel clear = new WC.Panel();
                clear.CssClass = "clear";
                container.Controls.Add(clear);
            }
        }
Пример #24
0
        private void CreateCoolPager(ASP.TableRow row, int columnSpan, ASP.PagedDataSource pagedDataSource) {
            int pageIndex = pagedDataSource.CurrentPageIndex;
            int pageCount = pagedDataSource.PageCount;
            int pageSize = pagedDataSource.PageSize;            
            int total = pagedDataSource.DataSourceCount;

            ASP.TableCell td = new ASP.TableCell();            
            DropDownList ddlPageSelector = new DropDownList();
            Button btnFirst = new Button();
            Button btnLast = new Button();
            Button btnNext = new Button();
            Button btnPrev = new Button();
            Label lblTotal = new Label();

            td.ColumnSpan = columnSpan;
            row.Cells.Add(td);
            td.Controls.Add(new LiteralControl("&nbsp;Page : "));
            td.Controls.Add(ddlPageSelector);
            td.Controls.Add(btnFirst);
            td.Controls.Add(btnPrev);
            td.Controls.Add(btnNext);
            td.Controls.Add(btnLast);
            td.Controls.Add(lblTotal);
            
            btnNext.Text = ">";
            btnNext.CommandArgument = "Next";
            btnNext.CommandName = "Page";
            
            btnLast.Text = ">>";
            btnLast.CommandArgument = "Last";
            btnLast.CommandName = "Page";

            btnFirst.Text = "<<";
            btnFirst.CommandArgument = "First";
            btnFirst.CommandName = "Page";
            
            btnPrev.Text = "<";
            btnPrev.CommandArgument = "Prev";
            btnPrev.CommandName = "Page";

            lblTotal.Text = this.TotalRecordString + "&nbsp;" + total.ToString();
            btnFirst.Enabled = btnPrev.Enabled = (pageIndex != 0);
            btnNext.Enabled = btnLast.Enabled = (pageIndex < (pageCount - 1));
            ddlPageSelector.Items.Clear();

            if (this.AddCallBacks) 
                ddlPageSelector.AutoCallBack = true;
            else
                ddlPageSelector.AutoPostBack = true;
            for (int i = 1; i <= pageCount; i++) 
                ddlPageSelector.Items.Add(i.ToString());
            ddlPageSelector.SelectedIndex = pageIndex;
            ddlPageSelector.SelectedIndexChanged += delegate {
                this.PageIndex = ddlPageSelector.SelectedIndex;
                this.DataBind();
            };
        }
Пример #25
0
        /// <summary>Adds the script to the item's attribute collection.</summary>
        /// <param name="control">The control to modify.</param>
        /// <param name="item">The <see cref="System.Web.UI.WebControls.ListItem"/> to modify.</param>
        /// <param name="attributeName">The attribute to modify.</param>
        /// <param name="script">The script to add.</param>
        public static void AddScriptAttribute(ASP.WebControl control, ASP.ListItem item, string attributeName, string script)
        {
            bool enableCallBack = !(control is ICallBackControl)
                || ((ICallBackControl)control).EnableCallBack;

            if (enableCallBack)
            {
                string newValue = script;
                string oldValue = item.Attributes[attributeName];
                if (oldValue != null && !oldValue.Equals(newValue))
                {
                    newValue = GetStringEndingWithSemicolon(oldValue) + script;
                }
                item.Attributes[attributeName] = newValue;
            }
        }
Пример #26
0
        /// <summary>
        /// Add a generic callback to the target control.
        /// </summary>
        /// <remarks>The target control is most often the same as the control that
        /// is raising the event, but the GridView (for example) is the target for all of it's 
        /// generated child controls.</remarks>
        private static void AddEventHandler(
            Control parent, 
            ASP.WebControl control,
            string eventName,
            string commandName, 
            string commandArgument, 
            bool causesValidation, 
            string validationGroup,
            string textDuringCallBack,
            bool enabledDuringCallBack,
            string preCallBackFunction,
            string postCallBackFunction,
            string callBackCancelledFunction)
        {
#if V2
            if (!IsNullOrEmpty(commandName) || !IsNullOrEmpty(commandArgument))
            {
                parent.Page.ClientScript.RegisterForEventValidation(parent.UniqueID,
                    string.Format("{0}${1}", commandName, commandArgument));
            }
#endif
            AddScriptAttribute(
                control,
                eventName,
                string.Format(
                    "javascript:Anthem_FireCallBackEvent(this,event,'{0}','{1}',{2},'{3}','','{4}',{5},{6},{7},{8},true,true);return false;",
                    parent.UniqueID,
                    IsNullOrEmpty(commandName) && IsNullOrEmpty(commandArgument) ? "" : commandName + "$" + commandArgument,
                    causesValidation ? "true" : "false",
#if V2
                    validationGroup,
#else
                    string.Empty,
#endif
                    textDuringCallBack,
                    enabledDuringCallBack ? "true" : "false",
                    IsNullOrEmpty(preCallBackFunction)  ? "null" : preCallBackFunction,
                    IsNullOrEmpty(postCallBackFunction) ? "null" : postCallBackFunction,
                    IsNullOrEmpty(callBackCancelledFunction) ? "null" : callBackCancelledFunction
                )
            );
        }
Пример #27
0
			internal MyMenu (MyWebControl.Adapters.MenuAdapter adapter) : base ()
			{
				menu_adapter = adapter;
			}
Пример #28
0
		/// <summary>
		///		Try to convert the test into the validation data type
		/// </summary>
		/// <param name="text"></param>
		/// <param name="type"></param>
		/// <param name="value"></param>
		/// <returns></returns>
		protected static bool Convert(string text, WebControls.ValidationDataType type, out object value)
		{
			return Convert(text, type, false, out value);
		}
Пример #29
0
		static Menu CreateMenuForRenderTests (MyWebControl.Adapters.MenuAdapter adapter, bool compatibilityRendering) 
		{
			Menu menu = new MyMenu (adapter);
#if NET_4_0
			if (compatibilityRendering)
				menu.RenderingCompatibility = new Version (3, 5);
#endif
			menu.ID = "Menu";
			MenuItem R, N1, N2, SN1, SN2, SN3, SN4;
			R = new MenuItem ("one-black", "one-black-value");
			N1 = new MenuItem ("two-black-1", "two-black-1-value");
			N2 = new MenuItem ("two-black-2", "two-black-2-value");
			SN1 = new MenuItem ("three-black-1", "three-black-1-value");
			SN2 = new MenuItem ("three-black-2", "three-black-2-value");
			SN3 = new MenuItem ("three-black-3", "three-black-3-value");
			SN4 = new MenuItem ("three-black-4", "three-black-4-value");
			SN1.ChildItems.Add (new MenuItem ("four-black-1", "four-black-1-value"));
			SN1.ChildItems.Add (new MenuItem ("four-black-2", "four-black-2-value"));
			SN2.ChildItems.Add (new MenuItem ("four-black-3", "four-black-3-value"));
			SN2.ChildItems.Add (new MenuItem ("four-black-4", "four-black-4-value"));
			SN3.ChildItems.Add (new MenuItem ("four-black-5", "four-black-5-value"));
			SN3.ChildItems.Add (new MenuItem ("four-black-6", "four-black-6-value"));
			SN4.ChildItems.Add (new MenuItem ("four-black-7", "four-black-7-value"));
			SN4.ChildItems.Add (new MenuItem ("four-black-8", "four-black-8-value"));
			N1.ChildItems.Add (SN1);
			N1.ChildItems.Add (SN2);
			N2.ChildItems.Add (SN3);
			N2.ChildItems.Add (SN4);
			R.ChildItems.Add (N1);
			R.ChildItems.Add (N2);
			menu.Items.Add (R);
			return menu;
		}
Пример #30
0
		private static Menu CreateMenuForRenderTests (MyWebControl.Adapters.MenuAdapter adapter) {
			Menu menu = new MyMenu (adapter);
			menu.ID = "Menu";
			MenuItem R, N1, N2, SN1, SN2, SN3, SN4;
			R = new MenuItem ("one-black", "one-black-value");
			N1 = new MenuItem ("two-black-1", "two-black-1-value");
			N2 = new MenuItem ("two-black-2", "two-black-2-value");
			SN1 = new MenuItem ("three-black-1", "three-black-1-value");
			SN2 = new MenuItem ("three-black-2", "three-black-2-value");
			SN3 = new MenuItem ("three-black-3", "three-black-3-value");
			SN4 = new MenuItem ("three-black-4", "three-black-4-value");
			SN1.ChildItems.Add (new MenuItem ("four-black-1", "four-black-1-value"));
			SN1.ChildItems.Add (new MenuItem ("four-black-2", "four-black-2-value"));
			SN2.ChildItems.Add (new MenuItem ("four-black-3", "four-black-3-value"));
			SN2.ChildItems.Add (new MenuItem ("four-black-4", "four-black-4-value"));
			SN3.ChildItems.Add (new MenuItem ("four-black-5", "four-black-5-value"));
			SN3.ChildItems.Add (new MenuItem ("four-black-6", "four-black-6-value"));
			SN4.ChildItems.Add (new MenuItem ("four-black-7", "four-black-7-value"));
			SN4.ChildItems.Add (new MenuItem ("four-black-8", "four-black-8-value"));
			N1.ChildItems.Add (SN1);
			N1.ChildItems.Add (SN2);
			N2.ChildItems.Add (SN3);
			N2.ChildItems.Add (SN4);
			R.ChildItems.Add (N1);
			R.ChildItems.Add (N2);
			menu.Items.Add (R);
			return menu;
		}