ASP.NET MVC - How to get flag values ​​in a message

Hi everyone, this is an ASP.NET MVC question for newbies.

I have a view that has a list of checkboxes and a submit button. When sending messages to the controller, but I cannot figure out how to get the values ​​of the flags. Also, I cannot figure out how to get the model data that I passed to the view, when I in the post method, I tried using Html.Hidden, but this does not seem to work.

Here's the code: http://pastebin.com/m2efe8a94 (Show) http://pastebin.com/m39ebc6b9 (Controller)

Thanks for any input received, Justin

-1
source share
2 answers

, . , , BeginForm, .

, IsOffered OfferTrade.

public ActionResult OfferTrade(FormCollection result, List<string> IsOffered)

ItemId IsOffered.

HtmlHelper CheckBox -, , , .

IsOffered List<int> , ItemId .

+3

, ItemId UserId :

<%= Html.Hidden("ItemId", Model.ItemIWant.ItemId) %>
<%= Html.Hidden("UserId", Model.ItemIWant.UserId) %>

//...

<% using (Html.BeginForm()) {%>

-, Controller " " ( )

public ActionResult OfferTrade(int ItemId, int UserId, IList<string> IsOfferred)

. , HtmlHelper CheckBox, , :

, , RTM MVC:

".Index", "" - ( 1).

0

All Articles