Я не совсем понимаю, что вы подразумеваете под добавлением флажков в представление без добавления их в модель представления , но позвольте мне попытаться проиллюстрировать это на примере:
Предположим, у вас есть следующая форма:
<a href="#" id="add">Add checkbox</a>
@using (Html.BeginForm())
{
<div id="placeholder"></div>
<input type="submit" value="OK" />
}
<script type="text/javascript">
var index = 0;
$('#add').click(function () {
$('#placeholder').append(
$('<input/>', {
type: 'checkbox',
name: 'foo[' + index + ']',
value: 'true'
})
).append(
$('<input/>', {
type: 'hidden',
name: 'foo[' + index + ']',
value: 'false'
})
);
index++;
return false;
});
</script>
и контроллер, который получил бы форму POST:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(IEnumerable<bool> foo)
{
// When you submit the form this action will be invoked
// and you will get an list of boolean values corresponding
// to each checkbox state
return View();
}
}