ASP.NET MVC Framework (Part 4): Handling Form Edit and Post Scenarios
page 5 of 15
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 59415/ 243

Implementing Add New Product (Part 1 - Background)

Let's now implement the "Add New Product" form post functionality of our site.  We'll ultimately want users to see a screen like below when they visit the /Products/New URL:

Figure 13

Form input and editing scenarios are typically handled in the ASP.NET MVC Framework by exposing two Action methods on a Controller class.  The first Controller Action method is responsible for sending down the HTML containing the initial form to display.  The second Controller action method is then responsible for handling any form submissions sent back from the browser.

For example, for our "Add Product" screen above we could choose to implement it across two different ProductsController actions: one called "New" and one called "Create".  The /Products/New URL would be responsible for displaying an empty form with HTML textboxes and drop-down list controls to enter new product details.  The HTML <form> element on this page would then have its "action" attribute set to the /Products/Create URL.  This means that when the user presses a form submit button on it, the form inputs will be sent to the "Create" action to process and update the database with.

Figure 14


View Entire Article

User Comments

Title: Stuck / adding Creat & New to my Controller.cs   
Name: Casey
Date: 2009-07-29 4:08:45 PM
Comment:
Hi,
I'm a newbie as if you don't hear that all day long.

I have setup a project that is to allow me to post information to a SQL database, and view the updated information. I can view just fine, however I'm stuck on where in my code to add the Create, and New Methods. If you would like to look at my code I can post it or email it.

Thank you,

Casey,
Title: text search for an table in asp.net mvcframework   
Name: senthil
Date: 2009-02-07 8:42:22 AM
Comment:
i want to make an text search on a column in a table.
for exampe i type a name in the text box and click a button then it should search the name in the column .

hope u help me

thanks in advance






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2020 ASPAlliance.com  |  Page Processed at 2020-07-05 10:29:16 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search