This project is read-only.

Why the RemoveArticle Action get the remove button value (Yes or No) as parameter?

Topics: Developer Forum
Sep 22, 2009 at 7:38 PM
The RemoveArticle.aspx view (p. 242.) has two submit button named both "remove", and has the value "Yes" or "No" respectively.

I don't understand, how the RemoveArticle action method (p.212.) get the remove button's value ("Yes" or "No") as string parameter, when the view page is inherited from the article object, and the Url.Action set only the articleID parameter to the viewData.model.ArticleID.

The default route doesn't contains any other parameter but the ArticleID too.
Does it mean, that I can get any view page element's value by the name of the control in the action method?
So, if I had a textBox in my view page that inherited from my entity MyCar, but has a textBox named City, wich isn't mapped to the model property, and this textbox contains a value "Paris", I can refer to that value in the ActionMethod, as parameter like this:
ActionView MyAction(string City)
Thanks in Advance

Sep 22, 2009 at 8:41 PM

I am not sure that I understand your question.  The buttons value getting submitted is a function of HTML.  Check out the W3C specs if you need more information about how this works.