Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια

C# and .NET Tips and Tricks

Quests in programming in .NET
ASP.NET MVC Binding to Lists–Enumerables on POST with JQuery
In this post we see how we can bind to editable IEnumerables-Lists in an ASP.NET MVC view and get the updated values in our HttpPost action. Moreover, we see how we can use JQuery to dynamically add/remove items from the list and have our updates transferred to the HttpPost action. We start by defining a simple class named Client which will be our list element: public class Client { public string FirstName { get ; set ; } public string LastName { get ; set ; } } We implement an Action method that creates a list of Client objects: public ViewResult Simple() { List < Client > Clients = new List < Client >(); Clients.Add( new Client { FirstName = "Giannis" , LastName = "Panagopoulos" }); Clients.Add( new Client { FirstName = "Kostas" , LastName = "Papadopoulos" }); Clients.Add( new Client { FirstName = "Petros" , LastName = "Georgiadis" }); return View(Clients); } The simple view renders the list as follows (with input elements of type text for

Διαβάστε περισσότερα »

Share
Posted: Δευτέρα, 29 Νοεμβρίου 2010 12:15 μμ από το μέλος iwannis
Δημοσίευση στην κατηγορία:

Σχόλια:

Χωρίς Σχόλια

Ποιά είναι η άποψή σας για την παραπάνω δημοσίευση;

(απαιτούμενο)

(απαιτούμενο)

(προαιρετικό)

(απαιτούμενο)
ÅéóÜãåôå ôïí êùäéêü:
CAPTCHA Image

Ενημέρωση για Σχόλια

Αν θα θέλατε να λαμβάνετε ένα e-mail όταν γίνονται ανανεώσεις στο περιεχόμενο αυτής της δημοσίευσης, παρακαλούμε γίνετε συνδρομητής εδώ

Παραμείνετε ενήμεροι στα τελευταία σχόλια με την χρήση του αγαπημένου σας RSS Aggregator και συνδρομή στη Τροφοδοσία RSS με σχόλια