Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950
|
BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950
This is the forum to discuss the Wrox book ASP.NET MVC Website Programming Problem Design Solution by Nicholas Berardi, Al Katawazi, and Marco Bellinaso; ISBN: 9780470410950
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2009, 05:43 AM
Authorized User
 
Join Date: Sep 2009
Posts: 34
Thanks: 4
Thanked 1 Time in 1 Post
Question Why the RemoveArticle Action get the remove button value (Yes or No) as parameter?

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 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.

Thanks in Advance

Gabor
 
Old September 22nd, 2009, 04:24 PM
Friend of Wrox
Points: 546, Level: 8
Points: 546, Level: 8 Points: 546, Level: 8 Points: 546, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 105
Thanks: 3
Thanked 20 Times in 19 Posts
Default

You might go back and read the text at the bottom of page 212 and top of 213.

If you run the code you will find that the first time into the removeArticle (and removeArticle control) view there is no value for the remove parameter (You've clicked on a remove link) and this is a confirmation where you must enter yes or no to proceed.

Initially I thought this might be a case where it would have been better to have an HTTP Get controller and an HTTP Post controller, but in retrospect it makes more sense to do it the way that it is. However, maybe there should be a redirect to a different location once yes or no is selected, but that would mess with the message that displays the choice made.

Steve

Last edited by Steve S; September 22nd, 2009 at 04:29 PM..
 
Old September 22nd, 2009, 05:56 PM
nberardi's Avatar
Wrox Author
 
Join Date: Aug 2008
Posts: 102
Thanks: 1
Thanked 16 Times in 16 Posts
Send a message via AIM to nberardi
Default

This works because any input value including buttons, select, input, and textarea all send their value back when a post or get is made. This is probably a little different than how you thought of them in Web Forms, but this is a function of the HTML specification that all the browsers support.
__________________
Check out my blog at: http://www.coderjournal.com
The Following User Says Thank You to nberardi For This Useful Post:
Gabor66 (September 22nd, 2009)
 
Old September 22nd, 2009, 06:30 PM
Authorized User
 
Join Date: Sep 2009
Posts: 34
Thanks: 4
Thanked 1 Time in 1 Post
Default

Thanks Nick.





Similar Threads
Thread Thread Starter Forum Replies Last Post
recordsource conditioned on multible parameter queries-action if no results returned BabaYaga Access VBA 9 May 13th, 2009 09:49 AM
based upon parameter perform action warsha_14 Struts 4 August 5th, 2006 04:51 AM
deleting data with an action button Vince_421 Access VBA 11 May 24th, 2006 08:02 AM
FlashMX Button action Lucian Ion Flash (all versions) 2 October 29th, 2003 11:27 AM
I want button action to change current window drb2k2 JSP Basics 0 June 4th, 2003 06:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.