Skip to content

Instantly share code, notes, and snippets.

@netojoa
Created January 17, 2020 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netojoa/79979c89dc090720c1ed53e5e7076db7 to your computer and use it in GitHub Desktop.
Save netojoa/79979c89dc090720c1ed53e5e7076db7 to your computer and use it in GitHub Desktop.
public class CreateHiddenFields: MvcPipelineProcessor<RenderFormEventArgs>
{
public override void Process(RenderFormEventArgs args)
{
// Hidden field for customId
var customId = (args.Attributes.ContainsKey("customId"))
? (string) args.Attributes["customId"]
: string.Empty;
if (!string.IsNullOrEmpty(customId))
args.HtmlHelper.ViewContext.Writer.Write(args.HtmlHelper.Hidden("CustomId", customId));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment