Monday, April 25, 2011

How can I get data from dynamic generated controls in ASP .NET MVC?

I want to generate a couple of checkboxes on an ASP .NET MVC page. How can I retrieve their data in a controller after posting the page?

From stackoverflow
  • Use the Request.Form collection:

    Request.Form["control-id"]
    

    or declare a FormsCollection parameter in your action method and use it to retrieve the value.

    Mehrdad Afshari : care to explain the reason for downvote?
    AnthonyWJones : +1: So far with the sketchiest of info in the question this is a reasonable answer.

0 comments:

Post a Comment