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


C# ValidationType.ToString方法代码示例

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


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

示例1: SubmitLink

		public static MvcHtmlString SubmitLink(this HtmlHelper helper, string title, string formId, string actionName, string controllerName, ValidationType validationType = ValidationType.All, object htmlAttributes = null, object submitParams = null)
		{
			var url = GetActionUrl(helper.ViewContext.RequestContext, actionName, controllerName);
			var paramsDictionary = new RouteValueDictionary(submitParams);
			var linkTag = GetSubmitTag("a", title, htmlAttributes);
			linkTag.Attributes.Add("href", "#");

			if (paramsDictionary.Count > 0)
			{
				var key = paramsDictionary.GetHashCode();
				var scriptTag = GetWrapperScriptTag(paramsDictionary, key);
				var script = String.Format("submitFormWithParams_{3}(this, event, '#{0}', '{1}', '{2}'); return false;", formId, url, validationType.ToString(), key);
				linkTag.Attributes.Add("onclick", script);
				return MvcHtmlString.Create(scriptTag.ToString(TagRenderMode.Normal) + linkTag.ToString(TagRenderMode.Normal));
			}
			else
			{
				var script = String.Format("submitFormWithoutParams(this, event, '#{0}', '{1}', '{2}'); return false;", formId, url, validationType.ToString());
				linkTag.Attributes.Add("onclick", script);
				return MvcHtmlString.Create(linkTag.ToString(TagRenderMode.Normal));
			}
		}
开发者ID:evkap,项目名称:DVS,代码行数:22,代码来源:SubmitButtonAndLink.cs

示例2: SubmitButton

		private static MvcHtmlString SubmitButton(HtmlHelper helper, string title, string formId, string actionName, string controllerName, ValidationType validationType, object htmlAttributes, RouteValueDictionary submitParams, bool addIcon, bool isIconFirst, string iconClass, string additionalScript)
		{
			if (addIcon)
			{
				var devider = !String.IsNullOrWhiteSpace(title) ? " " : string.Empty;
				var iconTemplate = String.Format("<i class='{0}'></i>", iconClass);
				if (isIconFirst)
				{
					title = String.Format("{0}{2}{1}", iconTemplate, title, devider);
				}
				else
				{
					title = String.Format("{0}{2}{1}", title, iconTemplate, devider);
				}
			}

			var routes = new RouteValueDictionary();
			foreach (var submitParam in submitParams)
			{
				routes.Add(submitParam.Key, submitParam.Value);
			}

			if (!routes.ContainsKey("controller"))
			{
				routes.Add("controller", controllerName);
			}

			if (!routes.ContainsKey("action"))
			{
				routes.Add("action", actionName);
			}

			var url = GetRouteUrl(helper.ViewContext.RequestContext, routes);
			var paramsDictionary = submitParams;
			var buttonTag = GetSubmitTag("button", title, htmlAttributes);
			buttonTag.Attributes.Add("type", "button");

			if (paramsDictionary.Count > 0)
			{
				var key = paramsDictionary.GetHashCode();
				var scriptTag = GetWrapperScriptTag(paramsDictionary, key);
				var script = String.Format("submitFormWithParams_{3}(this, event, '#{0}', '{1}', '{2}');", formId, url, validationType.ToString(), key);
				script = additionalScript == null ? script : String.Format("{0} {1}", additionalScript, script);
				buttonTag.Attributes.Add("onclick", script);
				return MvcHtmlString.Create(scriptTag.ToString(TagRenderMode.Normal) + buttonTag.ToString(TagRenderMode.Normal));
			}
			else
			{
				var script = String.Format("submitFormWithoutParams(this, event, '#{0}', '{1}', '{2}');", formId, url, validationType.ToString());
				script = additionalScript == null ? script : String.Format("{0} {1}", additionalScript, script);
				buttonTag.Attributes.Add("onclick", script);
				return MvcHtmlString.Create(buttonTag.ToString(TagRenderMode.Normal));
			}
		}
开发者ID:evkap,项目名称:DVS,代码行数:54,代码来源:SubmitButtonAndLink.cs


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