Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestModel
- {
- public string[] Values { get; set; }
- }
- public class HomeController : Controller
- {
- public ActionResult TestPost()
- {
- return View();
- }
- public void Test2(TestModel model)
- {
- //do something
- }
- }
- /*
- @model StackOverflow.Controllers.TestModel
- <script src="~/Scripts/jquery-1.7.1.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- $('#someButton').click(function () {
- $.ajax({
- url: '@Url.Action("Test2")',
- type: 'POST',
- data: $("#myForm").serialize()
- });
- });
- });
- </script>
- @using (Html.BeginForm("Test2", "Home", FormMethod.Post, new { id = "myForm" }))
- {
- @Html.ValidationSummary(true)
- <fieldset>
- <legend>TestModel</legend>
- <div id="MyDiv">
- <input type="checkbox" name="Values" value="test1" />
- <input type="checkbox" name="Values" value="test2" />
- <input type="checkbox" name="Values" value="test3" />
- </div>
- <p>
- <input type="button" value="Create" id="someButton" />
- </p>
- </fieldset>
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement