Return to Snippet

Revision: 15944
at July 21, 2009 09:57 by RockinForGod


Initial Code
public static string AntiSpamConfirmation(this HtmlHelper helper)
		{
			TagBuilder label = new TagBuilder("label");
			label.Attributes.Add("for", "sixtimesnine");
			label.InnerHtml = "Are you a spam robot?";

			TagBuilder p = new TagBuilder("p");
			p.InnerHtml = string.Format("{0}\n{1}\n{2}",
				label.ToString(TagRenderMode.Normal),
				helper.TextBox("sixtimesnine"),
				helper.Hidden("fourtytwo", "no"));

			return p.ToString();
		}

Initial URL


Initial Description
Outputs the required form elements to use the ValidateAntiSpamAttribute

Initial Title
ASP.NET MVC - Anti-spam HTML Helper

Initial Tags


Initial Language
C#