0

I'm new to ASP.NET and MVC in particular. Now, I'm trying to understand if I can easily get values of custom attributes of submitted data.

For example, When writing something like this inside a form (which works and posts and I can get the checkbox value) <%= Html.CheckBox("cb1", new { listen = "listen:6" }) %>

Can I get the value of "listen" directly or do I need JS? (I know I can just use hidden fields, but I'm I'm asking anyway)

Thanks

tereško
  • 58,060
  • 25
  • 98
  • 150
eddr
  • 38
  • 3

1 Answers1

1

You cannot; when a form is POST-ed, only the name/value pairs are sent. This is a general feature of HTML and forms, and not specific to ASP.NET or MVC.

Domenic
  • 110,262
  • 41
  • 219
  • 271